Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

git rebase -i commit flags?

Tags:

git

git-rebase

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?

like image 933
usretc Avatar asked Apr 06 '21 09:04

usretc


People also ask

What is git rebase commit?

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.

What is flag in git commit?

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.

Does rebase need commit?

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 .


1 Answers

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
like image 132
user3840170 Avatar answered Oct 16 '22 12:10

user3840170