Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Show diff when writing commit messages during an interactive rebase

When doing a regular git commit, git commit --verbose shows the diff in the text editor when writing the commit message.

Suppose I am doing an interactive rebase (git rebase --interactive) to edit previous commits. To 'continue' rebasing, I run git rebase --continue. This opens a text editor for editing the commit message, but it does not show the diff. After making changes to a commit, how can I display the diff when (re)writing the commit message during an interactive rebase?

git rebase --continue --verbose doesn't seem like a valid command...

like image 201
Flux Avatar asked Dec 27 '17 08:12

Flux


2 Answers

To show the diff:

git -c commit.verbose=true rebase --continue

To make all commits verbose without having to specify -c commit.verbose=true every time, add this to ~/.gitconfig:

[commit]
    verbose = true

Reference: man git-config.

like image 164
Flux Avatar answered Sep 28 '22 03:09

Flux


You can do:

git -c commit.verbose=true rebase --continue

If you get tired copying that command you can create an alias in your ~/.gitconfig:

[alias]
    myrebasecontinue = "!git -c commit.verbose=true rebase --continue"

And now just do:

git myrebasecontinue
like image 44
Arkadiusz Drabczyk Avatar answered Sep 28 '22 03:09

Arkadiusz Drabczyk