使用最新的git(2.1.0.24
),每当我尝试git rebase -i
来squash
一些提交时,squash无法detach HEAD
状态。我期望它能够将提交合并并像预期的那样放回我的分支上。我的工作树中没有未暂存的文件、更改或任何存储内容。为什么会这样?
> [master] » git rebase -i HEAD~3
(我压缩了几个提交)...
pick c9e9b62 Fixes super important bug #123.
squash c0dc9f9 wip
pick 5385a37 wip2
# Rebase fb83e59..5385a37 onto fb83e59
然后它就给了我
Note: checking out 'c9e9b62'.
You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.
If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:
git checkout -b new_branch_name
HEAD is now at c9e9b62... Fixes super-important bug #123.
could not detach HEAD
似乎成功地进行了变基,但出于某种原因无法将我放回分支。
> [c9e9b62] » git rebase --continue
No rebase in progress?
重塑尝试之前的git图形日志:
* 5385a37 (HEAD, master) wip2
* c0dc9f9 wip
* c9e9b62 Fixes super-important bug #123.
* ff80ed9 random commit msg
* 1f407d5 random commit msg
...
* ef106db random commit msg
* 6c244ef Merge branch 'sentences'
|\
| * a641cbf (origin/sentences) random commit msg
| * bfe8eae random commit msg
| ...
尝试rebase后的git图形日志:
* c9e9b62 (HEAD) Fixes super-important bug #123.
* ff80ed9 random commit msg
* 1f407d5 random commit msg
...
* ef106db random commit msg
* 6c244ef Merge branch 'sentences'
|\
| * a641cbf (origin/sentences) random commit msg
| * bfe8eae random commit msg
| ...
git rebase --continue
命令吗?还是执行了--abort
命令? - Edward Thomson