Skip to content

Instantly share code, notes, and snippets.

@rrajendran
Created February 11, 2013 21:58
Show Gist options
  • Select an option

  • Save rrajendran/4757979 to your computer and use it in GitHub Desktop.

Select an option

Save rrajendran/4757979 to your computer and use it in GitHub Desktop.
Loops through all the git projects and branches to a given name. usage: ./gitbranch.sh <branch-name>
#!/bin/bash
gitbranch() {
while read data; do
cd $data
git stash
git checkout $1 | cat
git pull
cd ..
echo
done
}
#list all directories, pipe to gitbranch.
ls -d */ | gitbranch $1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment