Add a bunch of git aliases including untracked, root and ignore.

This commit is contained in:
Ivan Malison 2014-04-16 17:32:01 -07:00
parent 3a3e826f7d
commit 23c7003fc9
3 changed files with 10 additions and 1 deletions

@ -1 +1 @@
Subproject commit 32aa532c7e076a843c21d621d496265e03f028b3
Subproject commit 11ab9113442bb886a30a7c79dead43b37f8c49c5

View File

@ -11,9 +11,12 @@
suir = submodule update --init --recursive
amend = commit -a --amend -C HEAD
modified = diff HEAD --name-only
untracked = "!u() { git status -s | grep "??" | awk '{print $2}'; }; u"
dirty = "!t() { test -n \"$(git status --porcelain)\"; }; t"
# diff tracking branch merge base
dtbmb = !git diff `git tb`...HEAD
root = rev-parse --show-toplevel
ignore = !"i() { printf \"\n$1\" >> "`git root`/.gitignore"; }; i"
branches = branch -a
remotes = remote -v
@ -34,6 +37,8 @@
reb = "!r() { git rebase -i HEAD~$1; }; r"
# Diff a file or show it in git's pager if it is untracked
du = "!d() { git ls-files $1 --error-unmatch 2>/dev/null 1>/dev/null && git diff $1 || `git config --get core.pager` $1; }; d"
clean-branches = "!r() { git branch -r --merged ${1-origin/master} | xargs -n1 git branch -d; }; r"
clean-remote-branches =
[core]
# Use custom `.gitignore` and `.gitattributes`

View File

@ -97,3 +97,7 @@ function clipboard() {
reattach-to-user-namespace pbcopy
fi
}
function git_root() {
cd `git root`
}