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
?
What is git rebase? Rebasing is the process of moving or combining a sequence of commits to a new base commit. Rebasing is most useful and easily visualized in the context of a feature branching workflow.
Add/Commit All By using the -a flag when committing you are telling Git to add all files that have been modified and then commit them. This runs into issues with new files, though. Since the -a flag only adds modified files it will not add new files or deleted files.
The Rebase Option But, instead of using a merge commit, rebasing re-writes the project history by creating brand new commits for each commit in the original branch. The major benefit of rebasing is that you get a much cleaner project history. First, it eliminates the unnecessary merge commits required by git merge .
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 thecommit.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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With