我有一个像A -> B -> C -> D -> E
. 我试图回滚C
并将其作为新修订提交,F
但似乎这不是正确的方法:我git checkout C
然后做一些更改,然后git commit
. 但是,当我git push origin HEAD
抱怨说:
error: unable to push to unqualified destination: HEAD
The destination refspec neither matches an existing ref on the remote nor
begins with refs/, and we are unable to guess a prefix based on the source ref.
正如这个 SO question所暗示的那样,我尝试过git fetch -p origin
,但没有奏效。仍然收到相同的错误消息。
我的问题是,我怎样才能摆脱这种情况并实现我最初的目标(回滚C
并承诺F
)?
此外,正如这个问题所暗示的,我可以:
git rm -r .
git checkout HEAD~3 .
git commit
但我真的不想这样做,git rm -r .
因为有很多未跟踪但有用的东西。