Skip to content

Instantly share code, notes, and snippets.

@fallwith
Created May 26, 2010 09:13
Show Gist options
  • Save fallwith/414259 to your computer and use it in GitHub Desktop.
Save fallwith/414259 to your computer and use it in GitHub Desktop.
# ~/.gitconfig
[user]
email = [email protected]
name = username
editor = mate -w
[color]
diff = auto
status = auto
branch = auto
[alias]
# list local branches, asterisk will indicate current branch
b = branch
# list local and remote branches, asterisk will indicate current branch
ba = branch -a
ci = commit
co = checkout
s = stash
ss = stash save
sl = stash list
sa = stash apply
sc = stash clear
st = status
# recommended undo for git
rv = checkout --
# display all defined git aliases
aliases = !git config --get-regexp 'alias.*'|colrm 1 6|sed 's/[ ]/ = /'
# if things are really screwed up in a clone
hard = reset --hard origin/master
# pretty log history
hist = log --since=1.day --relative-date --stat
mine = log --since=1.day --relative-date --stat --committer=fallwith
# determine the name of the current working (checked out) branch
bname = !sh -c 'git branch | sed -e "/^[^*]/d" | tr -d "^*\\ "'
# push a local branch to the remote repo
badd = !sh -c 'git push origin $0'
# pull/push from/to the remote repo for the current working branch
#bpull = !sh -c '_branch_name=`git bname|tr -d "\\\\n"` && git pull origin $_branch_name'
#bpush = !sh -c '_branch_name=`git bname|tr -d "\\\\n"` && git push origin $_branch_name'
bpull = !sh -c '_branch_name=`git bname` && git pull origin $_branch_name'
bpush = !sh -c '_branch_name=`git bname` && git push origin $_branch_name'
# begin tracking (add) a remote branch (requires git 1.5+)
btrack = !sh -c 'git checkout --track origin/$0'
# OR: btrack = !sh -c 'git branch --track $0 origin/$0'
# OR: btrack = !sh -c 'git co -t -b $0 remotes/origin/$0'
# OR: btrack = !sh -c 'git remote add -t origin/$0'
# delete a local branch that has been merged to master and not pushed to remote
bdel = branch -d
# delete a local branch that has not been merged and not pushed to remote
bdelf = branch -D
# delete a remote branch that has been merged
bdelr = !sh -c 'git branch -d -r origin/$0'
# delete a remote branch that has not been merged
bdelrf = !sh -c 'git branch -D -r origin/$0'
# wipe (remove) a remote branch from origin (remove the branch from GitHub)
bwipe = !sh -c 'git push origin :$0'
# add an empty dir to a repo (git emptydir [dirname])
emptydir = !bash -c 'str=$0/*\\\\n!.gitignore && mkdir -p $0 && echo -e $str > $0/.gitignore'
# report the current revision
revision = !git show|head -1|cut -c8-
rev = !git revision
[core]
excludesfile = ~/.gitignore
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment