3 回答
TA贡献1793条经验 获得超6个赞
这是一个命令,为您提供所有跟踪分支(配置为“拉”),请参阅:
$ git branch -vv main aaf02f0 [main/master: ahead 25] Some other commit* master add0a03 [jdsumsion/master] Some commit
您必须浏览SHA和任何长包装提交消息,但是它可以快速输入,并且我会在第3列中垂直对齐跟踪分支。
如果您需要有关每个分支的“拉”和“推”配置的信息,请参阅其他答案git remote show origin
。
更新
从git版本1.8.5开始,您可以使用git status
和显示上游分支git status -sb
TA贡献1783条经验 获得超4个赞
两种选择:
% git rev-parse --abbrev-ref --symbolic-full-name @{u}origin/mainline
要么
% git for-each-ref --format='%(upstream:short)' "$(git symbolic-ref -q HEAD)"origin/mainline
TA贡献1719条经验 获得超6个赞
我想git branch -av只会告诉你你有哪些分支以及它们在哪些提交,让你推断当地分支机构正在跟踪哪些远程分支。
git remote show origin明确告诉您哪些分支正在跟踪哪些远程分支。这是来自具有单个提交和远程分支的存储库的示例输出abranch:
$ git branch -av
* abranch d875bf4 initial commit
master d875bf4 initial commit
remotes/origin/HEAD -> origin/master
remotes/origin/abranch d875bf4 initial commit
remotes/origin/master d875bf4 initial commit
与
$ git remote show origin
* remote origin
Fetch URL: /home/ageorge/tmp/d/../exrepo/
Push URL: /home/ageorge/tmp/d/../exrepo/
HEAD branch (remote HEAD is ambiguous, may be one of the following):
abranch
master
Remote branches:
abranch tracked
master tracked
Local branches configured for 'git pull':
abranch merges with remote abranch
master merges with remote master
Local refs configured for 'git push':
abranch pushes to abranch (up to date)
master pushes to master (up to date)
- 3 回答
- 0 关注
- 785 浏览
添加回答
举报