9

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

Karl
  • 6,035
  • 5
  • 30
  • 39

4 Answers4

5

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).

Greg Hewgill
  • 951,095
  • 183
  • 1,149
  • 1,285
  • Very probable, I've seen the same happen on Linux with `gvim`. – Fred Foo Dec 22 '10 at 20:43
  • I'll try the batch thing...this worked on my old machine however, and I don't see how my current one would be different. I've tried using the same editor and a different one, both of which have this problem. – Karl Dec 22 '10 at 21:19
  • Solved it, turned out to be some weirdness with the way msysgit takes paths. http://stackoverflow.com/questions/1634161/how-do-i-use-notepad-or-other-with-msysgit – Karl Dec 22 '10 at 21:32
  • @larsmans: how did you solve it? I have the same problem on Linux, also with `gvim` – eckes Nov 25 '15 at 12:59
4

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/

Boghyon Hoffmann
  • 17,103
  • 12
  • 72
  • 170
Matt
  • 1,140
  • 2
  • 10
  • 17
  • 1
    +1. My `core.editor` was missing the `--wait` part. For VSCode users, use `git config --global core.editor "code --wait"` as described in the link. – Boghyon Hoffmann Jul 28 '21 at 21:52
2

Solved, related to the editor variable in git-config:

How do I use Notepad++ (or other) with msysgit?

Community
  • 1
  • 1
Karl
  • 6,035
  • 5
  • 30
  • 39
0

I was using the Notepad++ while I encountered the same issue.

I was in the Administrator mode of Notepad++.

Back to normal mode solved my issue.

Hareen Laks
  • 1,432
  • 2
  • 17
  • 33