19

I'm trying to rebase a commit. However, any time I run git rebase -i f83eff3ffc8, for example, a MacVim window opens, that's empty (there is no information in the file). Then once I write and close the file (even though it's empty), I get a Successfully rebased and updated refs/heads/clicktocall-hotfix message.

The file name is .git/rebase-merge/git-rebase-todo. I also tried running it with sudo but this didn't make a difference.

What could be the problem? I've never successfully completed a rebase.

Kevin Burke
  • 61,194
  • 76
  • 188
  • 305
  • 2
    Nothing to do with vim. Removed tag. – manojlds Jan 04 '12 at 07:20
  • 2
    It looks like git is succesfully performing a "no-op" rebase. What are you trying to do? Please describe your branch structure and where the commit `f83eff` is. You might find this helpful: http://www-cs-students.stanford.edu/~blynn/gitmagic/ch05.html – opqdonut Jan 04 '12 at 08:19
  • 1
    Exactly, an empty rebase -i file means you try and rebase the HEAD itself, this is not how git rebase works. – fge Jan 04 '12 at 08:55
  • Readded vim tag as that's what's invoked by default when issuing git rebase -i. – Adam Dymitruk Jan 04 '12 at 16:06
  • I have this same problem, but I'm not using vim. I'm running git from a Cygwin terminal, and I've tried setting my `core.editor` to a bunch of different editors such as notepad2 and GitExtensions, but I keep getting the empty file when I try to do an interactive rebase, and I don't know why. notepad2 works when I do `git commit`. I've heard that `rebase` is actually a perl script, so maybe that might have something to do with it? I'm using git version 1.8.1.3. –  Feb 20 '13 at 00:25
  • Maybe it has something to do with Windows vs *nix line-ending formats? –  Feb 20 '13 at 00:28
  • Been playing around with stuff, it might have something to do with the way paths are represented in perl and/or Cygwin, I tried interactive rebase with plain vanilla notepad, and I got the empty file in the editor, but it also said that the path was not recognized. –  Feb 20 '13 at 00:50

5 Answers5

15

For atom I was able to fix by adding the wait flag to gitconfig (reference https://help.github.com/articles/associating-text-editors-with-git/)

[core]
    editor = atom --wait 
myfashionhub
  • 427
  • 3
  • 11
5

I was using Macvim and needed to run mvim with the -f option, as documented here: GIT_EDITOR not working with macvim

Community
  • 1
  • 1
Kevin Burke
  • 61,194
  • 76
  • 188
  • 305
  • 3
    For reference. I had a similar problem when switching from Sublime to Atom and forgot to update git editor. This should help: git config --global core.editor "atom --wait" – Pascal Jul 09 '15 at 07:30
2

Ran into this as well in VS Code, and the issue was that I had forgotten the "wait" flag in my editor config.

Solved by running:

git config --global core.editor "code --wait"
Joshua Comeau
  • 2,594
  • 24
  • 25
0

I was using Atom and run into this problem. I set my default editor like this:

export VISUAL=vim
export EDITOR="$VISUAL"

Now everything is working great.

TL;DR; Use Vim.

Capuchin
  • 3,465
  • 6
  • 28
  • 40
-1

You should not even have to look at the git-rebase-todo file. Vim should display a noop line and some comments. After saving that, you should get "Successfully rebased and updated ".

You are either using an old version of git, you have a broken git install or you have touched the .git folder in some way to cause it to behave this way.

Adam Dymitruk
  • 124,556
  • 26
  • 146
  • 141