refname是模棱两可的,并且失败了

时间:2011-12-21 01:23:57

标签: git branch

我运行了以下命令,因为我想先移动我的生产分支,而不必先检查:

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不会返回任何输出。我以前有一个生产存储库,但我现在已将其重命名为

> ~/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

日志

我将第一个修订标记为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

3 个答案:

答案 0 :(得分:6)

如果您只想删除警告:

git config --global core.warnambiguousrefs false

警告即将发生,因为您有一个名为production的分支,还有一个名为production的远程分支。将两者中的任何一个重命名为其他东西是理想的。

答案 1 :(得分:6)

> ~/repo (chris-membership-fees)$ git show-ref | grep production
88e0c37c9ae4ff6967ddd027b62b62fa2c0ac272 refs/heads/production
9d739cff44a898f0c68da33fb22a230985e479ce refs/remotes/backup/production
88e0c37c9ae4ff6967ddd027b62b62fa2c0ac272 refs/remotes/production/master
由于refs/heads/production

refs/remotes/production含糊不清。分辨率是通用的,独立于引用类型前缀,因此分支,标签,遥控器甚至自定义引用名称都不得相互冲突。

答案 2 :(得分:6)

感谢Johannes Sixt关于Git mailing list

  

最可能的原因是你直接参与了'生产'   .git目录。也许您或您的一个脚本创建了它   意外地使用'git update-ref production ae5b621',即没有   给出完整的ref路径名称

它实际上并不在.git根目录中,但我在分支机构中有一个空的生产文件夹。