这不是 找出本地分支正在跟踪哪个远程分支,如果我有多个远程分支,我可能在所有远程分支中都有"主". git branch返回master但我不知道我所在的主分支是在remoteFoo还是remoteBar中.例如,我可能会这样做:
git clone someRepo.git
cd someRepo
git remote add anotherRemote otherremoteURL
Run Code Online (Sandbox Code Playgroud)
然后git remote显示
someRepo
anotherRemote
Run Code Online (Sandbox Code Playgroud)
我能做的git checkout -b master someRepo/master还是git checkout -b master anotherRemote/master和git branch会说"主人",在这两种情况下.我如何取回第一部分"someRepo"或"anotherRemote"?
你认为我可以使用,git remote show但它需要一个参数,你想要信息的遥控器的名称.
$ git remote show origin
fatal: 'origin' does not appear to be a git repository
fatal: The remote end hung up unexpectedly
$ git remote show
someRepo
anotherRemote
Run Code Online (Sandbox Code Playgroud)
随着git branch我得到的是什么电流指示:
$ git branch
hold
* master
old-stuff
refactor
Run Code Online (Sandbox Code Playgroud)
但是git remote输出中没有"*" .
bee*_*urs 10
您可能需要尝试以下方法来详细查看信息.
git remote -v
git remote -v show origin
Run Code Online (Sandbox Code Playgroud)
示例输出如下:
dmasi@:/var/www/pirate_booty$ git remote -v
origin git@bitbucket.org:dmasi/pirate_booty_calculator.git (fetch)
origin git@bitbucket.org:dmasi/pirate_booty_calculator.git (push)
dmasi@:/var/www/pirate_booty$ git remote -v show origin
* remote origin
Fetch URL: git@bitbucket.org:dmasi/pirate_booty_calculator.git
Push URL: git@bitbucket.org:dmasi/pirate_booty_calculator.git
HEAD branch: master
Remote branch:
master tracked
Local branch configured for 'git pull':
master merges with remote master
Local ref configured for 'git push':
master pushes to master (up to date)
Run Code Online (Sandbox Code Playgroud)
git status -sb 似乎很容易理解和记住。
-s代表以短格式给出输出。
b用于显示分支和跟踪信息。
参考:https : //git-scm.com/docs/git-status#git-status--s
| 归档时间: |
|
| 查看次数: |
4140 次 |
| 最近记录: |