This is basically what happens:
> git rebase -i HEAD~3
Successfully rebased and updated refs/heads/master.
Pops open my text editor then immediately "completes" the rebase before I even have the chance to do anything. Anyone know what might be causing this?
I'm using msysgit on Windows 7: git version 1.7.3.1.msysgit.0
git rebase rewrites the commit history. It can be harmful to do it in shared branches. It can cause complex and hard to resolve merge conflicts. In these cases, instead of rebasing your branch against the default branch, consider pulling it instead ( git pull origin master ).
You can run rebase interactively by adding the -i option to git rebase . You must indicate how far back you want to rewrite commits by telling the command which commit to rebase onto. Remember again that this is a rebasing command — every commit in the range HEAD~3..
you can abort the rebase by deleting the entire contents of the editor window and saving it, or causing the editor to close with an error code. In vim this can be accomplished with d SHIFT+g followed by :wq , or alternatively causing the editor to exit with an error as Mike H-R pointed out out using :cq .
This is probably because Git expects that the text editor will stop and wait until you have finished editing before continuing. Your text editor could start up in such a way that it appears that it immediately finished as far as Git can see.
You could try setting the EDITOR
environment variable to point to a batch file that does something like:
start /wait my_editor %*
(but this is just a guess and I'm not in a situation to test it right now).
I use Atom - and was getting the same problem.
git config --global core.editor "atom --wait"
... fixed it for me straight away.
More info about setting up different code editors can be found here: https://help.github.com/articles/associating-text-editors-with-git/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With