jakub-g / dotfiles

:heavy_dollar_sign: Lots of aliases, mostly git-related
https://gist.github.com/jakub-g
2 stars 0 forks source link

git annotate + extended gb #11

Open jakub-g opened 4 years ago

jakub-g commented 4 years ago
function gbb { NUM=${1:-10}; git for-each-ref --sort=-committerdate --format="%(committerdate:short) %(refname:short)" refs/heads/ | head -${NUM} | xargs -n2 sh -c 'echo -n $1 $2;  ANNO=".git/_annotations_/$2"; if [ -f "$ANNO" ] ; then echo -e -n " --> \033[36m"$(cat "$ANNO")"\033[0m"; fi; echo' sh; }
function gann { FOLDER=./.git/_annotations_/; mkdir -p $FOLDER; BRANCH=$(git rev-parse --abbrev-ref HEAD); echo "$@" > "${FOLDER}/${BRANCH}"; }
function gannx { FOLDER=./.git/_annotations_/; mkdir -p $FOLDER; BRANCH="$1"; echo "${@:2}" > "${FOLDER}/${BRANCH}"; }

Usage:

gann Update webpack config
gbb
gbb 20
jakub-g commented 4 years ago
alias gbx='git for-each-ref --sort=-committerdate --format="%(committerdate:short) %(refname:short) %(color:cyan) %(contents:subject)" refs/heads/'