Git can be configured in ~/.gitconfig
. Here is an overview about common configurations.
Please keep this default config simple. It should be a starting point for new developers learning Git.
To appear with your name in commits:
[user]
name = Your Name
email = your.name@domain.de
[color]
ui = auto
# The value for these configuration variables is a
# list of colors (at most two) and attributes (at
# most one), separated by spaces.
# The colors accepted are:
# normal, black, red, green, yellow, blue, magenta, cyan and white
# The attributes are:
# bold, dim, ul, blink and reverse
#
# The first color given is the foreground; the second
# is the background. The position of the attribute,
# if any, doesn’t matter.
[color "branch"]
current = yellow reverse
local = yellow
remote = green
[color "diff"]
whitespace = white reverse
meta = blue reverse
frag = blue reverse
old = red
new = green
[color "status"]
added = green
changed = yellow
untracked = cyan
[push]
default = current
Please only use an alias if you understand what it does.
[alias]
amend = commit -v --amend # Amend changes to last commit
c = commit -v -m # Commit with message from command line, usage: git c "commit message"
lc = show --name-status # Show last commit
lou = log --oneline @{u}.. # List unpushed commits
uncommit = reset HEAD~ --soft
riu = rebase -i @{u} # Interactive rebase against upstream
du = diff @{u} # Diff against upstream
"Upstream" is the branch on origin
where your current local branch is pulling from and pushing to.