git fetch 的奇怪行为
我在 GIT fetch 方面遇到了一个大问题...看看这个
$ git fetch
From server:project
422b4cb..a04c062 master -> origin/master
$ git show-ref
ba113be885e66a5306d1646cd3db0801170c04f8 refs/heads/alpha-release
a04c062261beeb4a951337ebb58745945cac3562 refs/heads/master
a04c062261beeb4a951337ebb58745945cac3562 refs/heads/test
a04c062261beeb4a951337ebb58745945cac3562 refs/remotes/origin/HEAD
ba113be885e66a5306d1646cd3db0801170c04f8 refs/remotes/origin/alpha-release
a04c062261beeb4a951337ebb58745945cac3562 refs/remotes/origin/master
还有另一个 git fetch
:
$ git fetch
From server:project
+ a04c062...422b4cb HEAD -> origin/HEAD (forced update)
$ git show-ref
ba113be885e66a5306d1646cd3db0801170c04f8 refs/heads/alpha-release
a04c062261beeb4a951337ebb58745945cac3562 refs/heads/master
a04c062261beeb4a951337ebb58745945cac3562 refs/heads/test
422b4cbac3db2784c8f6e94ffd99c7afcda9122d refs/remotes/origin/HEAD
ba113be885e66a5306d1646cd3db0801170c04f8 refs/remotes/origin/alpha-release
422b4cbac3db2784c8f6e94ffd99c7afcda9122d refs/remotes/origin/master
还有另一个...
$ git fetch
From server:project
422b4cb..a04c062 master -> origin/master
$ git show-ref
ba113be885e66a5306d1646cd3db0801170c04f8 refs/heads/alpha-release
a04c062261beeb4a951337ebb58745945cac3562 refs/heads/master
a04c062261beeb4a951337ebb58745945cac3562 refs/heads/test
a04c062261beeb4a951337ebb58745945cac3562 refs/remotes/origin/HEAD
ba113be885e66a5306d1646cd3db0801170c04f8 refs/remotes/origin/alpha-release
a04c062261beeb4a951337ebb58745945cac3562 refs/remotes/origin/master
还有另一个 git fetch
:
$ git fetch
From server:project
+ a04c062...422b4cb HEAD -> origin/HEAD (forced update)
$ git show-ref
ba113be885e66a5306d1646cd3db0801170c04f8 refs/heads/alpha-release
a04c062261beeb4a951337ebb58745945cac3562 refs/heads/master
a04c062261beeb4a951337ebb58745945cac3562 refs/heads/test
422b4cbac3db2784c8f6e94ffd99c7afcda9122d refs/remotes/origin/HEAD
ba113be885e66a5306d1646cd3db0801170c04f8 refs/remotes/origin/alpha-release
422b4cbac3db2784c8f6e94ffd99c7afcda9122d refs/remotes/origin/master
我的 refs /remotes/origin/HEAD
和 refs/remotes/origin/master
总是强制更新到 422b4cb
...
发生了什么? 422b4cb
...是一个旧的提交。
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
哇...在与 GIT 进行了一场激烈的斗争之后,我仅使用以下方法解决了这个问题:
Wow...after a big fight with GIT I fixed this issue just using:
我看到这种行为的唯一另一个例子是 此线程:
也许提交
422b4cb
是在引入名为“HEAD
”的分支时引入的?注意(7 年后):使用 Git 2.16 (Q1 2018),您将无法创建名为 HEAD 的分支 无论如何。
The only other instance where I saw that kind of behavior was in this thread:
Maybe commit
422b4cb
was when that branch called 'HEAD
' was introduced?Note (7 years later): with Git 2.16 (Q1 2018), you won't be able to create a branch named HEAD anyway.
我不确定是什么导致了这个问题,但是如果您有 git 存储库的 shell 访问权限,您可以修复它:
的相同
它与工作副本中 。就我而言,我们将存储库设置为拒绝分支删除,因此在这种情况下我必须登录并手动执行此操作。
I'm not sure what causes this problem, but you can fix it if you have shell access to the git repository:
It is the same as
in the working copy. In my case we have the repo set up to deny branch deletion, so I had to log in and do it manually in this case.