Skip to content

Instantly share code, notes, and snippets.

@stouset
Created July 5, 2011 12:03
Show Gist options
  • Save stouset/1064719 to your computer and use it in GitHub Desktop.
Save stouset/1064719 to your computer and use it in GitHub Desktop.
Git Config
[alias]
current-branch = "!f() { B=$(git symbolic-ref HEAD) && echo ${B#refs/heads/}; }; f"
current-remote = "!f() { B=$(git config branch.$(git current-branch).remote) && echo ${B}; }; f"
current-merge = "!f() { B=$(git config branch.$(git current-branch).merge) && echo ${B#refs/heads/}; }; f"
current-track = "!f() { R=$(git current-remote) && M=$(git current-merge) && echo ${R}/${M}; }; f"
remove = "!f() { git ls-files --deleted -z $@ | xargs -0 git rm -r; }; f"
addremove = "!f() { git add -v ${@-.}; git remove $@; }; f"
incoming = "!f() { T=$( [ \"${1}\" == \"\" ] && echo $(git current-track) || echo ${1} ) && git log ..${T}; }; f"
outgoing = "!f() { T=$( [ \"${1}\" == \"\" ] && echo $(git current-track) || echo ${1} ) && git log ${T}..; }; f"
wip = "!f() { git addremove $@; git commit -m 'Work in progress'; }; f"
unwip = reset HEAD^
merge-feature = merge --no-ff
last = log -n
staged = diff --cached
recommit = commit --amend -CHEAD
changed = log ORIG_HEAD.. --stat --no-merges --decorate
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment