Search code examples
gitgit-rebase

git rebase -i commit flags?


When applying a squashed or reworded commit, rebase -i invokes the commit editor automatically. I'm used to committing with commit -v (I want to see what diff I'm committing), but the rebase-invoked git commit seems to not set -v. This is super-annoying when squashing commits.

Is there a way to configure the git commit flags for use inside the rebase loop?


Solution

  • From git-commit(1):

    -v, --verbose

    Show unified diff between the HEAD commit and what would be committed at the bottom of the commit message template to help the user describe the commit by reminding what changes the commit has. Note that this diff output doesn’t have its lines prefixed with #. This diff will not be a part of the commit message. See the commit.verbose configuration variable in git-config[1].

    This means the verbose mode can be permanently enabled globally by doing

    git config --global commit.verbose true
    

    This way, the -v option will be enabled by default from now on.

    Alternatively, the option can be enabled on a per-command basis by passing the -c global option:

    git -c commit.verbose=true rebase -i