I'd like to make it so that if I type git recent in my terminal, it actually runs:
git reflog | egrep -io "moving from ([^[:space:]]+)" | awk '{ print $3 }' | awk ' !x[$0]++' | egrep -v '^[a-f0-9]{40}$' | head -n5
giving me the 5 most recent git branches I've checked out to.
Bonus points: I'd like to add an argument, so that if I type git recent 20 it runs: git reflog | egrep -io "moving from ([^[:space:]]+)" | awk '{ print $3 }' | awk ' !x[$0]++' | egrep -v '^[a-f0-9]{40}$' | head -n20
giving me the 20 most recent git branches I've checked out to.
Also, any readings/tutorials series to recommend in to better understand how this script works, and how to write custom bash scripts? Thanks.