diff --git a/gitalias.txt b/gitalias.txt index 84cabecd..42630956 100644 --- a/gitalias.txt +++ b/gitalias.txt @@ -102,6 +102,17 @@ ### branch ### + # list branches along with their description + bv = !"f(){\ + T=$(printf \\\t);\ + git branch \"$@\" --format='%(refname:short) %(HEAD)%09%(objectname:short)%09%(contents:subject)'|\ + while read -r l;do\ + d=$(git config \"branch.${l%% *}.description\");\ + echo \"$l${d:+$T($d)}\";\ + done|\ + column -ts\"$T\";\ + };f" + # branch and only list branches whose tips are reachable from the specified commit (HEAD if not specified). bm = branch --merged @@ -390,6 +401,9 @@ # This is a slightly modified version fixup = "!f() { TARGET=$(git rev-parse \"$1\"); git commit --fixup=$TARGET && GIT_EDITOR=true git rebase --interactive --autosquash $TARGET~; }; f" + # Shorthand to stash/rebase/unstash + fix = !"f(){ git rebase --autostash -i \"${@:-HEAD^^}\";};f" + ### reflog ### # reflog - reference log that manages when tips of branches are updated. @@ -1089,6 +1103,9 @@ # clone-lean = clone --depth 1 --filter=combine:blob:none+tree:0 --no-checkout + # Save the current branch (for example, prior a rebase) + backup-branch = !"git branch backup/$(date +%F/%H-%M-%S)" + # Stash snapshot - from http://blog.apiaxle.com/post/handy-git-tips-to-stop-you-getting-fired/ # Take a snapshot of your current working tree without removing changes. # This is handy for refactoring where you can't quite fit what you've done