Skip to content

Instantly share code, notes, and snippets.

@skeep
Last active December 19, 2018 17:02
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save skeep/bcac1ebce758665a9a73843d186236ff to your computer and use it in GitHub Desktop.
Save skeep/bcac1ebce758665a9a73843d186236ff to your computer and use it in GitHub Desktop.
#!/bin/bash
GREEN='\033[0;32m';
NC='\033[0m';
nameFromConfig=`git config --global user.name`;
echo Enter your git name [$nameFromConfig]:
read name
if [ -z "$name" ]
then
name=${nameFromConfig}
fi
echo -e "Getting remote branshes of ${GREEN}${name}${NC} ..."
for branch in `git branch -r | grep -v HEAD`;do echo -e `git show --format="%ai %ar by %an" $branch | head -n 1` \\t$branch; done | sort -r | grep "${name}" > branches.txt
echo -e "List of branches of ${GREEN}${name}${NC} now available at ${GREEN}branches.txt${NC} file."
cat branches.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment