Skip to content

Instantly share code, notes, and snippets.

@iszlai
Created April 11, 2018 06:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iszlai/14f8e809f4c540e999a156b073222adc to your computer and use it in GitHub Desktop.
Save iszlai/14f8e809f4c540e999a156b073222adc to your computer and use it in GitHub Desktop.
#!/bin/bash
#Define the color yellow for later use
YELLOW='\033[0;33m'
#Define text reset
NC='\033[0m'
pathToRepos=~/work/repos
for i in `ls $pathToRepos`;do
repo=$pathToRepos"/"$i
#Get curreny branch name
branch=`git -C $repo symbolic-ref --short -q HEAD`
if [ -d $repo/.git ]; then
echo -e "\n${YELLOW}#"$i"#${NC} - ${branch}\n"
git -C $repo stash
git -C $repo pull --rebase
git -C $repo stash pop
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment