How can I configure git commit
to act as git commit -v
(showing the full diff being committed) by default?
Using an alias is not quite satisfactory, as it does not affect commit message editing during operations which may indirectly commit, such as git rebase
.
A shortcut command that immediately creates a commit with a passed commit message. By default, git commit will open up the locally configured text editor, and prompt for a commit message to be entered. Passing the -m option will forgo the text editor prompt in-favor of an inline message.
On Windows, if you use Git Bash the default editor will be Vim. Vim is another text editor, like nano or notepad. In order to get started Vim there are only a few commands you must remember.
Usually the first commit is named "Initial commit". As best practice its include a README file describing the project. The README is usually is a md file. You can put any code you wish as well.
The Conventional Commits specification is a lightweight convention on top of commit messages. It provides an easy set of rules for creating an explicit commit history; which makes it easier to write automated tools on top of.
As far as I can tell, you can not override an already existing git command with an alias (otherwise, there would be no way to do the original command, and a bunch of stuff would break).
So I recommend you do something like git config --global "alias.ci" "commit -v"
. This will add a line to your ~/.gitconfig
file and make it so that git ci
does git commit -v
. You should then just get into the habit of typing git ci
instead of git commit
(unless you decide you don't want the -v
).
If you are using git 2.9, this can be done with a config.
git config --global commit.verbose true
Git 2.9.0 Release Notes: https://github.com/git/git/blob/v2.9.0/Documentation/RelNotes/2.9.0.txt
"git commit" learned to pay attention to the "commit.verbose" configuration variable and act as if the "--verbose" option was given from the command line.
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