Skip to content

Instantly share code, notes, and snippets.

@koiralakiran1
Last active April 26, 2024 07:45
Show Gist options
  • Save koiralakiran1/ab4fc5867e8ea9d7f7356eb4ead9e13b to your computer and use it in GitHub Desktop.
Save koiralakiran1/ab4fc5867e8ea9d7f7356eb4ead9e13b to your computer and use it in GitHub Desktop.
Git recent branches
#!/usr/bin/awk -f
BEGIN {
FS=" ~~ "
print "\033[1;31mYour recent checkouts:\n"
}
{
print "\033[1;32m"$1"\033[0;32m ("substr($2,7,index($2,"}")-7)") [\033[1;33mCommitted by:\033[1;34m",$4"\033[0;32m on "$5"\033[0m] \n ",
$3"\n"
#print "\033[1;32m"$1"\033[0;32m ("substr($2,7,index($2,"}")-7)")\033[0m | "$3,
# "\n [\033[1;33mCommitted by:\033[0m",$4"\033[0;32m on "$5"\033[0m] \n"
}
#!/usr/bin/env bash
# alias git_recent="..."
git reflog show --pretty=format:'%gs ~~ %gd ~~ %s ~~ %an ~~ %ch, (%cr)' --date=relative | grep -i 'checkout:' | grep -oE '[^ ]+ ~~ .*' | awk -F~ '!seen[$1]++' | head -n 10 | ./git_recent_checkouts.awk
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment