Initial Git Configuration

1 minute read

After Git is set up it is good idea to customize it.

Information to identify Yourself

me@host$ git config --global user.name "John Doe"
me@host$ git config --global user.email johndoe@example.com

Preferred editor

me@host$ git config --global core.editor nano

Diff/Merge tool

me@host$ git config --global merge.tool kdiff3

Prevent some possible problems

Defines the action git push should take if no refspec is given on the command line, no refspec is configured in the remote, and no refspec is implied by any of the options given on the command line. “Current” means push the current branch to a branch of the same name.

me@host$ git config --global push.default current

Useful configuration

Here are some useful configuration values described.

In addition to .gitignore (per-directory) and .git/info/exclude, git looks into this file for patterns of files which are not meant to be tracked. “~/” is expanded to the value of $HOME and “~user/” to the specified user’s home directory

me@host$ git config --global core.excludesfile <path to file>

Specify a file to use as the template for new commit messages. “~/” is expanded to the value of $HOME and “~user/” to the specified user’s home directory.

me@host$ git config --global commit.template <path to file>

Useful commands

Here are some useful commands described

Displaying console graph log

me@host$ git log --oneline --graph --decorate

Show a word diff highlighting changed words using only colors

me@host$ git diff --word-diff=color

Leave a Comment

Your email address will not be published. Required fields are marked *

Loading...