在一个肮脏的回购中暧昧的refmane

时间:2014-02-24 13:09:19

标签: git

这是一个测试仓库,所以我可以删除它或提交并完成它。但是,我很生气,我无法重置或存储更改并修复回购(模棱两可的refmane):

swilson@swlap1:~/gits/test$ git status
warning: refname 'HEAD' is ambiguous.
warning: refname 'HEAD' is ambiguous.
# Not currently on any branch.
# Changes not staged for commit:
#       modified:   test
#       modified:   test2
#
no changes added to commit

好的,所以尽量让repo干净:

swilson@swlap1:~/gits/test$ git reset --hard
warning: refname 'HEAD' is ambiguous.
warning: refname 'HEAD' is ambiguous.
warning: refname 'HEAD' is ambiguous.
warning: refname 'HEAD' is ambiguous.
warning: refname 'HEAD' is ambiguous.
warning: refname 'HEAD' is ambiguous.
warning: refname 'HEAD' is ambiguous.
warning: refname 'HEAD' is ambiguous.
warning: refname 'HEAD' is ambiguous.
warning: refname 'HEAD' is ambiguous.
warning: refname 'HEAD' is ambiguous.
warning: refname 'HEAD' is ambiguous.
warning: refname 'HEAD' is ambiguous.
warning: refname 'HEAD' is ambiguous.
warning: refname 'HEAD' is ambiguous.
HEAD is now at 374f306 test2 id

不。好的,尝试隐藏更改:

swilson@swlap1:~/gits/test$ git stash
warning: refname 'HEAD' is ambiguous.
warning: refname 'HEAD' is ambiguous.
warning: refname 'HEAD' is ambiguous.
warning: refname 'HEAD' is ambiguous.
warning: refname 'HEAD' is ambiguous.
Saved working directory and index state WIP on (no branch): 374f306 test2 id
warning: refname 'HEAD' is ambiguous.
warning: refname 'HEAD' is ambiguous.
warning: refname 'HEAD' is ambiguous.
warning: refname 'HEAD' is ambiguous.
warning: refname 'HEAD' is ambiguous.
warning: refname 'HEAD' is ambiguous.
warning: refname 'HEAD' is ambiguous.
warning: refname 'HEAD' is ambiguous.
warning: refname 'HEAD' is ambiguous.
warning: refname 'HEAD' is ambiguous.
warning: refname 'HEAD' is ambiguous.
warning: refname 'HEAD' is ambiguous.
warning: refname 'HEAD' is ambiguous.
warning: refname 'HEAD' is ambiguous.
warning: refname 'HEAD' is ambiguous.
HEAD is now at 374f306 test2 id

不。所以,试着删除分支:

swilson@swlap1:~/gits/test$ git branch -d HEAD
error: Cannot delete the branch 'HEAD' which you are currently on.

不,不。从哪里来?

[编辑1]

swilson@swlap1:~/gits/test$ git branch foo
warning: refname 'HEAD' is ambiguous.
fatal: Ambiguous object name: 'HEAD'.

[编辑2]

swilson@swlap1:~/gits/kore_tools.git/test$ git branch -a
* (no branch)
  master
  mergetest
  remotes/origin/HEAD -> origin/master
  remotes/origin/master

1 个答案:

答案 0 :(得分:1)

HEAD不是分支 - 它是指向历史记录中当前位置的指针。

  warning: refname 'HEAD' is ambiguous.

表示您的当前位置(HEAD)未绑定到任何分支。你可以使用

git branch <branch-name>

从当前位置创建新的早午餐,此消息将消失