Git settings

From Dreamwidth Notes
Revision as of 08:04, 22 August 2012 by Swaldman (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

This page currently lists a few git settings that I've found useful on my 'hack. I'm hoping that an experienced git user may add anything else that's nifty or important.

Levels of settings & how to change them

git has three levels of settings: system-wide, per-user, and per-repo. All the examples given below are per-user, which is probably the most useful on dreamhacks. git refers to per-user settings as "global".

These can be viewed or set with the git config command.

You can use git config --list to see the settings that you have at present.

Recommended settings

To add your username and email to commits:

git config --global user.name=???
git config --global user.email=???

where the ???s should be replaced with a username and email address. It is probably good practice to make this the same email address that you use for bugzilla.

To avoid having to type in your github username and password every time you push something,

git config --global credential.helper=cache

This will cache your details for 15 minutes so that you will not have to enter them again during that time.

To put a number of git command-line commands' output into colour, to make them more readable:

git config --global color.branch=auto
git config --global color.diff=auto
git config --global color.status=auto
git config --global color.ui=auto

To set your preferred text editor (used for writing commit notes):

git config --global core.editor=nano

(change nano to the text editor of your choice)