但是,对于远程分支,以下post命令应该会产生相同的输出
git fetch
git branch -a 显示执行时不可见的远程分支
git ls-remote --heads origin这种行为的原因是什么?
澄清
(TA216441) $ git pull
Your configuration specifies to merge with the ref 'refs/heads/TA216441'
from the remote, but no such ref was fetched.
(TA216441) $ git fetch
(TA216441) $ git branch -a
* TA216441
TA216442
master
remotes/origin/HEAD -> origin/master
remotes/origin/TA212425
remotes/origin/TA216441
remotes/origin/TA219346
remotes/origin/TA220305
remotes/origin/TA223738
remotes/origin/master
(TA216441) $ git ls-remote --heads origin
hash-1 refs/heads/DE18756_2
hash-2 refs/heads/TA212425
hash-2 refs/heads/TA219346
hash-3 refs/heads/TA220305
hash-4 refs/heads/master发布于 2017-11-03 17:24:06
运行git branch -a会列出计算机上的所有本地分支和跟踪分支,这两个分支都存在于本地。下面是我在运行git branch -a时得到的结果
master
branch1
remotes/origin/HEAD -> origin/master
remotes/origin/master
remotes/origin/branch1但是,当您运行git ls-remote --heads origin时,它会列出您的存储库中的远程head引用。对于相同的repo,这是我所看到的:
b9e515799... refs/heads/master
9a7faebd1... refs/heads/branch1存储库只有真正的远程分支,当您使用git pull之类的东西时,它实际上就是您要同步的分支。
https://stackoverflow.com/questions/47092063
复制相似问题