Skip to content

Instantly share code, notes, and snippets.

@schwern
Created May 25, 2011 22:02
Show Gist options
  • Star 7 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save schwern/992097 to your computer and use it in GitHub Desktop.
Save schwern/992097 to your computer and use it in GitHub Desktop.
My git aliases
[alias]
st = status
ci = commit -v
cii = commit -v --interactive
cia = commit -v -a
addi = add --interactive
addchanged = add -u
br = branch
co = checkout
diffwords = diff --word-diff
rebranch = branch -f
svnpush = svn dcommit
svnpull = svn rebase
pick = cherry-pick -s
save = stash save
savepatch = stash save --patch
savescratch = stash save --keep-index
pop = stash pop
praise = blame -w
archeology = blame -w -C -n
whodoikill = blame -w -C -n
logfile = log --follow -C
plog = !git log --pretty=format:'%C(yellow)%h%Creset %s %Cblue%d%Creset' --graph --all
who = shortlog -sen --
grep4d = !sh -c 'git log -p -S'$1' $2' -
# 2009-05-26 (merged-bed-bug) 6fe85ff regenerate rules Brad Bowman
logdate = log --format=format:'%ad %d %h %s %an%n' --date=short
brdate = !"sh -c 'for b in `git branch --no-merged` ; \
do git logdate -1 -r $b --; done'"
up = !git stash && git pull origin master && git stash apply
stag = tag -s
retag = tag -f
bookmark = tag -a
unstage = reset HEAD
redo = reset --soft HEAD^
clear = reset --hard HEAD
undo = reset --hard HEAD^
repull = pull --rebase
hist = log --all --graph --pretty='[%C(cyan)%h%Creset]%C(bold cyan)%d%Creset %s'
mergefeature = merge --no-ff
export = !sh -c 'git checkout-index --prefix=$1 -a' -
@rjbs
Copy link

rjbs commented May 25, 2011

Here are sone of mine:

ci = commit -a
cl = clean -dfx
cc = cherry-pick
ff = merge --ff-only
fx = commit -a --amend -C HEAD
ix = diff --cached
st = status -sb

@schwern
Copy link
Author

schwern commented May 26, 2011

@rjbs All useful stuff. -sb is a handy option to status I wasn't aware of. I'll have to learn the shorthand though. It would be handy if there was something in between, one like the regular status but without the tutorial info.

Is the -C HEAD redundant with --amend?

@melo
Copy link

melo commented May 26, 2011

I have some of that:

st = status -sb
ci = commit
co = checkout
revert-file = checkout HEAD --
staged = diff --cached
c = cat-file
human = name-rev --name-only --refs=refs/heads/*

... but you some great ones. Thanks for sharing.

@rjbs
Copy link

rjbs commented May 26, 2011

-C HEAD is not redundant. --amend alone will bring up your editor to edit the last commit message; -C HEAD will re-use the last commit message without prompting to change

it's great for "oops, I made a typo in the code or forgot to add a file": git add missing.txt && git fx

(fx = fixup)

@yanick
Copy link

yanick commented May 26, 2011

Mine are at https://github.com/yanick/environment/blob/master/git/gitconfig Although there is nothing original in there -- it's all stolen from better, smarter peoples. (and yes, that means the examples given above will soon be assimilated as well :-) )

@built
Copy link

built commented May 29, 2011

whodoikill is hilarious, even more so when archeology is the same thing.

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