devl.cz/ git

GIT

Config

Global configuration goes to ~/.gitconfig. This can be edited by git commands or by hand.

Following commands will set up basic user info:

git config --global user.name "John Doe"
git config --global user.email "john.doe@example.com"

In config, it looks like this:

[user]
name = John Doe
email = john.doe@example.com

Let's fill the rest directly.

Essentials:

[alias]
# Classic convenient shortcuts
ci = commit
co = checkout
st = status

# Too long to type...
id = rev-parse HEAD
info = remote show origin
tree = log --graph --stat

# List branches. This alias is safer than using `branch` directly,
# it won't create a new (weirdly named) branch if you mistype the args.
branches = branch -vv

[fetch]
# Prune after fetch/pull (git remote prune origin)
# Set this if you don't like zombie remotes.
prune = true

Tools:

[core]
editor = mcedit