diff --git a/dotfiles/emacs.d b/dotfiles/emacs.d index 32aa532c..11ab9113 160000 --- a/dotfiles/emacs.d +++ b/dotfiles/emacs.d @@ -1 +1 @@ -Subproject commit 32aa532c7e076a843c21d621d496265e03f028b3 +Subproject commit 11ab9113442bb886a30a7c79dead43b37f8c49c5 diff --git a/dotfiles/gitconfig b/dotfiles/gitconfig index da906fff..f651fe7b 100644 --- a/dotfiles/gitconfig +++ b/dotfiles/gitconfig @@ -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` diff --git a/dotfiles/lib/shellrc/functions.sh b/dotfiles/lib/shellrc/functions.sh index 47557e0c..cffae2d7 100644 --- a/dotfiles/lib/shellrc/functions.sh +++ b/dotfiles/lib/shellrc/functions.sh @@ -97,3 +97,7 @@ function clipboard() { reattach-to-user-namespace pbcopy fi } + +function git_root() { + cd `git root` +}