更新项目
This commit is contained in:
parent
ce2ccfa802
commit
e7d78f249d
|
@ -33,11 +33,12 @@ class ProjectInit(Task):
|
||||||
|
|
||||||
repo.git.fetch(remote_name)
|
repo.git.fetch(remote_name)
|
||||||
|
|
||||||
# 2. 创建本地分支并跟踪远程分支
|
if repo.active_branch.name != branch_name:
|
||||||
remote_branch_ref = f"{remote_name}/{branch_name}"
|
# 2. 创建本地分支并跟踪远程分支
|
||||||
local_branch = repo.create_head(branch_name, remote_branch_ref) # 创建本地分支指向远程
|
remote_branch_ref = f"{remote_name}/{branch_name}"
|
||||||
local_branch.set_tracking_branch(repo.remotes[remote_name].refs[branch_name]) # 设置跟踪
|
local_branch = repo.create_head(branch_name, remote_branch_ref) # 创建本地分支指向远程
|
||||||
local_branch.checkout() # 切换到该分支
|
local_branch.set_tracking_branch(repo.remotes[remote_name].refs[branch_name]) # 设置跟踪
|
||||||
|
local_branch.checkout() # 切换到该分支
|
||||||
|
|
||||||
self.context.local_repo_branch = repo.active_branch.name
|
self.context.local_repo_branch = repo.active_branch.name
|
||||||
self.context.local_repo_commit = repo.head.commit.hexsha[:10]
|
self.context.local_repo_commit = repo.head.commit.hexsha[:10]
|
||||||
|
|
Loading…
Reference in New Issue