Skip to content

Instantly share code, notes, and snippets.

@schwern
Created August 1, 2012 19:21
Show Gist options
  • Save schwern/3229915 to your computer and use it in GitHub Desktop.
Save schwern/3229915 to your computer and use it in GitHub Desktop.
[color]
# Turn on colors as applicable
ui = auto
[alias]
# Shortcuts
st = status
br = branch
co = checkout
# Normal commit command, but show the diff being committed
ci = commit -v
# Interactive commit
cii = commit -v --interactive
# Commit everything
cia = commit -v -a
# Interactive add
addi = add --interactive
addp = add -p
# Add only changes to already checked in files
addchanged = add -u
# Word based diff
diffwords = diff --word-diff
rebranch = branch -f
# Make git-svn work a bit more like a normal remote
svnpush = svn dcommit
svnpull = svn rebase
# Signed cherry picks
pick = cherry-pick -s
# Save and pop the stash
save = stash save
pop = stash pop
# Interactive stashing
savepatch = stash save --patch
# Stash only unadded stuff
savescratch = stash save --keep-index
# blame but ignore whitespace
praise = blame -w -n
# More intense digging, follow file copies and moves
archeology = blame -w -C -M -n
whodoikill = blame -w -C -M -n
# More intense logging to follow file copies and moves
logfile = log --follow -C
# Pretty print the log showing branches
hist = log --pretty=format:'%C(yellow)%h%Creset %s %Cblue%d%Creset' --graph --all
# List who's made edits and how many
who = shortlog -sen --
# Search for a string in a change across history git grep4d <string> file
grep4d = !sh -c 'git log --follow -C -p -S'$1' $2' -
# Show the log with the data of each change
logdate = log --format=format:'%ad %d %h %s %an%n' --date=short
# Show the date of the last change to each branch. Doesn't work quite right.
brdate = !"sh -c 'for b in `git branch --no-merged` ; \
do git logdate -1 -r $b --; done'"
# An attempt to emulate "svn up"
up = !git stash && git pull origin master && git stash apply
# Signed tags
stag = tag -s
# Replace a tag
retag = tag -f
# Tags with notes attached
bookmark = tag -a
# Remove everything from the staging area, but keep the working copy
unstage = reset HEAD
# Undo the last commit, but leave it in the working copy
redo = reset --soft HEAD^
# Throw out all work up to the last commit
clear = reset --hard HEAD
# Undo the last commit
undo = reset --hard HEAD^
# Pull but rebase instead of merge
repull = pull --rebase
# Always merge, never fast-forward, a feature branch. The branch makes it
# easier to see why the changes were done. The merge point acts as a point
# to summarize the changes.
mergefeature = merge --no-ff
# Attempt to emulate 'svn export'. git export <target dir>
export = !sh -c 'git checkout-index --prefix=$1 -a' -
[branch]
# When branching and making remotes, set up merge tracking automatically
autosetupmerge = true
[push]
default = tracking
[core]
quotepath = false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment