I'm trying to squash a few commits in a git repository.
> git rebase -i HEAD~3
Successfully rebased and updated refs/heads/staging.
A file opens titled git-rebase-todo
:
pick a2f3467 Require statement incorrect
pick c41212e Require file in environment
pick 2743221 This should work
# Rebase c5f42f3..2743221 onto c5f42f3
# ..........
I tried changing the bottom two commits to squash
from pick
. I save the file, and I get the following error:
Unable to save ~/Documents/code/myapp/.git/rebase-emrge/git-rebase-todo
The problem is that when sublimetext2 is started, it doesn't block and immediately returns. Git then thinks that you're done editing the file and performs the rebase. That's why you see the
Successfully rebased and updated refs/heads/staging
message, before you even edited the file. Use the subl
command instead, which is designed for such use. The github help tells you do configure it with
git config --global core.editor "subl -n -w"