我正在尝试压缩 git 存储库中的一些提交。
> git rebase -i HEAD~3
成功重新定位和更新 refs/heads/staging。
打开一个名为 git-rebase-todo
的文件:
pick a2f3467 Require statement incorrect
pick c41212e Require file in environment
pick 2743221 This should work
# Rebase c5f42f3..2743221 onto c5f42f3
# ..........
我尝试将底部的两个提交从 pick
更改为 squash
。我保存文件,但出现以下错误:
无法保存 ~/Documents/code/myapp/.git/rebase-emrge/git-rebase-todo
最佳答案
问题是当sublimetext2启动的时候,没有阻塞,直接返回。然后 Git 认为您已完成文件编辑并执行 rebase 。这就是为什么你看到了
Successfully rebased and updated refs/heads/staging
消息,甚至在您编辑文件之前。使用 subl
命令代替,它是为这种用途而设计的。 github help告诉你用
git config --global core.editor "subl -n -w"
关于git - Git 的问题 - rebase/squash,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15384502/