Skip to content

Instantly share code, notes, and snippets.

@dadreggors
Created July 3, 2014 17:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dadreggors/7097da2653e901371a19 to your computer and use it in GitHub Desktop.
Save dadreggors/7097da2653e901371a19 to your computer and use it in GitHub Desktop.
Helpful git alias
[alias]
a = add
ap = add -p
b = branch
bb = "!git for-each-ref --sort='-authordate' --format='%(authordate)%09%(objectname:short)%09%(refname)' refs/heads | sed -e 's-refs/heads/--'"
c = commit
cam = commit -a -m
cav = commit -a --verbose
cm = commit -m
co = checkout
cob = checkout -b
copr = "!f() { git fetch -fu origin refs/pull/$1/head:pr-$1; git checkout pr-$1; } ; f"
cv = commit --verbose
d = diff
dc = diff --cached
ds = diff --stat
dt = difftool
l = log --pretty=format:"%C(yellow)%h\\ %ad%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --date=short
la = "!git config -l | grep alias | cut -c 7-"
ll = log --pretty=oneline --abbrev-commit --graph --decorate
m = merge
mt = mergetool
prunepr = "!git for-each-ref refs/heads/pr-* --format='%(refname:short)' | while read ref ; do git branch -D $ref ; done"
s = status
ss = status -s
@dadreggors
Copy link
Author

The .gitconfig file is your global config located in your home directory (usually "~/.gitconfig" in Unix or Linux).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment