Git

Git系列5:Git Tracking Branches

2020-01-02  本文已影响0人  XBruce

查看Tracking Branches:

$ git branch
  branch1
* master

$ git branch --all
  branch1
* master
  remotes/origin/master  #This is the tracking branch.

查看Tracking branch信息

$ git log origin/master --oneline -5
b1a2fd9 (HEAD -> master, origin/master) Merge branch 'featureX'
bc6f532 from master
5598e7d test git merge conflict
0f03a6a Merge branch 'featureY'
44591ba test add featureY

改变Tracking branch origin/HEAD指针

git remote set-head origin branch1

本地添加一个文件之后,提交

$ git commit -m "add feature 1"
[master 01b8b49] add feature 1
 1 file changed, 1 insertion(+)
 create mode 100644 feature1.txt

此时查看状态,会提示当前的分支比origin/master超前一个commit.

$ git status
On branch master
Your branch is ahead of 'origin/master' by 1 commit.
  (use "git push" to publish your local commits)

nothing to commit, working tree clean

总结


image.png
上一篇 下一篇

猜你喜欢

热点阅读