Adding a Tracking Branch
Goals
- Learn how to add a local branch that tracks a remote branch.
The branches starting with remotes/origin are branches from the original repo. Notice that you don’t have a branch called greet anymore, but it knows that the original repo had a greet branch.
Add a local branch that tracks a remote branch.
Execute:
git branch --track greet origin/greet
git branch -a
git hist --max-count=2
Output:
$ git branch --track greet origin/greet
Branch 'greet' set up to track remote branch 'greet' from 'origin'.
$ git branch -a
greet
* master
remotes/origin/HEAD -> origin/master
remotes/origin/greet
remotes/origin/master
$ git hist --max-count=2
* b39ac69 2020-06-20 | Changed README in original repo (HEAD -> master, origin/master, origin/HEAD) [Jim Weirich]
* e0cc19e 2020-06-20 | Updated Rakefile (origin/greet, greet) [Jim Weirich]
We can now see the greet branch in the branch list and in the log.
当前内容版权归 gitimmersion 或其关联方所有,如需对内容或内容相关联开源项目进行关注与资助,请访问 gitimmersion .