refname 不明确且拉取失败
我运行了以下命令,因为我想将生产分支移回,而无需先签出:
git branch -f production HEAD~1
现在,当我签出生产时,我收到以下警告:
warning: refname 'production' is ambiguous.
然后我运行:
git pull
我收到以下错误:
First, rewinding head to replay your work on top of it...
Fast-forwarded production to 7463e01c536ad52746b8879ef3d70ffd5a8db31e.
error: Ref refs/heads/production is at 252038dfa22caba8a816a68dcb005c625e44c51f but expected ae5b621609c1b5b430e3d30711157298f842942a
fatal: Cannot lock the ref 'refs/heads/production'
Could not move back to refs/heads/production
我可以拉其他分支。我该如何解决这个问题?
更多信息
git tag
不返回任何输出。我以前有一个生产存储库,但现在将其重命名为 live
> ~/repo (chris-membership-fees)$ git show-ref | grep production
88e0c37c9ae4ff6967ddd027b62b62fa2c0ac272 refs/heads/production
9d739cff44a898f0c68da33fb22a230985e479ce refs/remotes/backup/production
~/repo (chris-membership-fees)$ git branch -a | grep production
production
remotes/backup/production
Log
我将第一个修订版标记为 a,将第二个修订版标记为 b(请注意,由于生产现在不同,修订版号已更改) 。这是原木,经过装饰简化
* commit 7463e01c536ad52746b8879ef3d70ffd5a8db31e (**tag: a**, backup/live-master, production, live-master)
|
| Date: Wed Dec 28 11:47:49 2011 +1100
|
| Merge remote-tracking branch 'origin/joseph-quick-fix'
|
* commit f35f0259c4e36d46dd1df71b3293bef6105cef98 (origin/hotfix-googleplusdirectconnect)
|
| Date: Fri Dec 23 12:25:27 2011 +1100
|
| Add google plus link tag to home page for direct connect
|
* commit 8b3a30ef2909439ac18b65ebbb316eb0cdd2d61c
|\ Merge: f696f3e 88e0c37
| |
| | Date: Wed Dec 21 14:28:45 2011 +1100
| |
| | Merge branch 'master' into chris-hotfix
| |
* | commit f696f3e2b8f4a19ec2b2c2a3638c68e7a52836e3 (origin/chris-hotfix, backup/chris-hotfix, chris-hotfix)
| |
| | Date: Wed Dec 21 11:56:10 2011 +1100
| |
| | Fixed buyer price info
| |
| * commit 88e0c37c9ae4ff6967ddd027b62b62fa2c0ac272
| |\ Merge: c9655da ae5b621
| |/
|/| Date: Wed Dec 21 11:53:36 2011 +1100
| |
| | Merge branch 'master' of git.freelancer.com:production into production
| |
* | commit ae5b621609c1b5b430e3d30711157298f842942a (HEAD, **tag: b**)
| |
| | Date: Wed Dec 21 10:51:47 2011 +1100
| |
| | Merge branch 'master' of git.freelancer.com:production
| |
| * commit c9655da9c1627ab53720ae818affdd1e6f14119f (origin/game-shadow2)
| |
| | Date: Tue Dec 20 18:41:57 2011 -0500
| |
| | * Removed debugging code
| |
| * commit ca88d33538bd3b99ea7c186b5b531e611847989d
| |\ Merge: 99e983a c397a8b
| |/
|/| Date: Tue Dec 20 17:25:24 2011 -0500
| |
| | Merge remote-tracking branch 'production/master' into shadow2
I ran the following command as I wanted to move my production branch back without having to checkout first:
git branch -f production HEAD~1
I am now getting the following warning when I checkout production:
warning: refname 'production' is ambiguous.
I then run:
git pull
And I receive the following error:
First, rewinding head to replay your work on top of it...
Fast-forwarded production to 7463e01c536ad52746b8879ef3d70ffd5a8db31e.
error: Ref refs/heads/production is at 252038dfa22caba8a816a68dcb005c625e44c51f but expected ae5b621609c1b5b430e3d30711157298f842942a
fatal: Cannot lock the ref 'refs/heads/production'
Could not move back to refs/heads/production
I can pull on other branches though. How can I fix this?
Further Info
git tag
doesn't return any output. I previously had a production repository, but I've now renamed it to live
> ~/repo (chris-membership-fees)$ git show-ref | grep production
88e0c37c9ae4ff6967ddd027b62b62fa2c0ac272 refs/heads/production
9d739cff44a898f0c68da33fb22a230985e479ce refs/remotes/backup/production
~/repo (chris-membership-fees)$ git branch -a | grep production
production
remotes/backup/production
Log
I tagged the first revision as a and the second as b (note that the revision numbers have changed as production is now different). This is the log, simplified by decoration
* commit 7463e01c536ad52746b8879ef3d70ffd5a8db31e (**tag: a**, backup/live-master, production, live-master)
|
| Date: Wed Dec 28 11:47:49 2011 +1100
|
| Merge remote-tracking branch 'origin/joseph-quick-fix'
|
* commit f35f0259c4e36d46dd1df71b3293bef6105cef98 (origin/hotfix-googleplusdirectconnect)
|
| Date: Fri Dec 23 12:25:27 2011 +1100
|
| Add google plus link tag to home page for direct connect
|
* commit 8b3a30ef2909439ac18b65ebbb316eb0cdd2d61c
|\ Merge: f696f3e 88e0c37
| |
| | Date: Wed Dec 21 14:28:45 2011 +1100
| |
| | Merge branch 'master' into chris-hotfix
| |
* | commit f696f3e2b8f4a19ec2b2c2a3638c68e7a52836e3 (origin/chris-hotfix, backup/chris-hotfix, chris-hotfix)
| |
| | Date: Wed Dec 21 11:56:10 2011 +1100
| |
| | Fixed buyer price info
| |
| * commit 88e0c37c9ae4ff6967ddd027b62b62fa2c0ac272
| |\ Merge: c9655da ae5b621
| |/
|/| Date: Wed Dec 21 11:53:36 2011 +1100
| |
| | Merge branch 'master' of git.freelancer.com:production into production
| |
* | commit ae5b621609c1b5b430e3d30711157298f842942a (HEAD, **tag: b**)
| |
| | Date: Wed Dec 21 10:51:47 2011 +1100
| |
| | Merge branch 'master' of git.freelancer.com:production
| |
| * commit c9655da9c1627ab53720ae818affdd1e6f14119f (origin/game-shadow2)
| |
| | Date: Tue Dec 20 18:41:57 2011 -0500
| |
| | * Removed debugging code
| |
| * commit ca88d33538bd3b99ea7c186b5b531e611847989d
| |\ Merge: 99e983a c397a8b
| |/
|/| Date: Tue Dec 20 17:25:24 2011 -0500
| |
| | Merge remote-tracking branch 'production/master' into shadow2
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
感谢 Git 邮件列表 上的 Johannes Sixt。
它实际上并不在 .git 根目录中,但我在分支中有一个空的生产文件夹。
Thanks to Johannes Sixt on the Git mailing list.
It wasn't actually in the .git root directory, but I had an empty production folder in branches.
由于
refs/remotes/product
,refs/heads/product
是不明确的。解析是通用的并且独立于引用类型前缀,因此分支、标签、远程甚至自定义引用名称都不能发生冲突。refs/heads/production
is ambiguos due torefs/remotes/production
. Resolution is generic and independent of the reference-type prefix, thus branches, tags, remotes and even custom ref names must not collide.如果您只想删除警告:
警告即将到来,因为您有一个名为 production 的分支,还有一个名为 production 的远程分支。将两者中的任何一个重命名为其他名称都是理想的选择。
If you just want to remove the warning:
The warning is coming because you have a branch named production and also a remote named production. It will be ideal to rename either of the two to something else.