(no title)
fantapop | 2 years ago
# show the last 10 branches I used
lb = !git reflog show --pretty=format:'%gs ~ %gd' --date=relative | grep 'checkout:' | grep -oE '[^ ]+ ~ .*' | awk -F~ '!seen[$1]++' | head -n 10 | awk -F' ~ HEAD@{' '{printf(\" \\033[33m%s: \\033[37m %s\\033[0m\\n\", substr($2, 1, length($2)-1), $1)}'
# checkout the previous branch I was using
cop = !git checkout --recurse-submodules $(git reflog show --pretty=format:'%gs ~ %gd' --date=relative | grep 'checkout:' | grep -oE '[^ ]+ ~ .*' | awk -F~ '!seen[$1]++' | head -n 10 | grep -v $(git branch --show-current) | head -1 | cut -d' ' -f1)
MattBearman|2 years ago
fantapop|2 years ago