7

After a rebase failed with a conflict, I could not continue the rebase using a Git GUI client. When performing

git rebase --continue

on command line (msysgit 1.7.4), it opened a text editor. After having closed it, Git continued. How can opening the editor be avoided?

Mot
  • 28,248
  • 23
  • 84
  • 121
  • What did the editor have in it? `rebase --continue` shouldn't spawn one, but other rebase operations do - and whenever Git starts an editor, it's because there really is something you might want to modify. – Cascabel Mar 15 '11 at 18:33
  • Does this answer your question? [How to suppress the editor for \`git rebase --continue\`?](https://stackoverflow.com/questions/43489971/how-to-suppress-the-editor-for-git-rebase-continue) – Bergi Aug 27 '23 at 22:33

2 Answers2

3

When a rebase fails, you have to manually fix the file and then exec git add filename to signal that everything is OK. At this point, git rebase --continue will continue the procedure without bothering you.

To change the default editor git uses issue: git config --global core.editor new_editor

Commands such as commit and tag that lets you edit messages by launching an editor uses the value of this variable when it is set, and the environment variable GIT_EDITOR is not set. See git-var(1).

karlphillip
  • 92,053
  • 36
  • 243
  • 426
  • 2
    The conflicted file had been fixed and staged. Nevertheless, Git opened the text editor. – Mot Mar 15 '11 at 15:46
  • By *staged* you mean you executed `git add` on all files that have been changed? – karlphillip Mar 15 '11 at 15:51
  • It seems your `git rebase` is actually doing `git rebase -i`. Do you have aliases for git somewhere? – karlphillip Mar 15 '11 at 15:55
  • That's not the std behavior on Git for Linux. Maybe msysgit behaves different. – karlphillip Mar 15 '11 at 16:15
  • I don't use the command line, but my tool executed `git.exe rebase --preserve-merges `. The (now disappeared) tip for setting `GIT_EDITOR` to `cat` helped. :) – Mot Mar 15 '11 at 16:15
  • 2
    I'm using `git rebase -i` on Linux and it's more interactive than I want it, opening editor for commit messages with no good reason. Using `EDITOR=cat` fixes it. – Pavel Šimerda Feb 18 '15 at 12:24
  • 1
    @Pavel EDITOR=true works just as well without spilling the message file to the console. – Rik Renich Jul 13 '19 at 17:55
1

When a rebase incurs in conflicts, the user may need to make notable changes for resolving the them. Git assumes that the user wishes to modify the commit message, commenting on the conflict resolution.

This is documented in the paragraph Commit Rewording of the git rebase man page.

A way to prevent the editor from being opened, and to confirm the original commit message is the following:

$ GIT_EDITOR=true git rebase --continue
Arialdo Martini
  • 4,427
  • 3
  • 31
  • 42