Skip to content

Instantly share code, notes, and snippets.

@tonythomas01
Created May 21, 2019 08:32
Show Gist options
  • Save tonythomas01/6c0d05a304bf9f5c74f2e9569cd38523 to your computer and use it in GitHub Desktop.
Save tonythomas01/6c0d05a304bf9f5c74f2e9569cd38523 to your computer and use it in GitHub Desktop.
Update all repos in your directory to a branch.
#!/usr/bin/env bash
# This will update all git repos in your present working directory to target: branch
# Inspired from: https://stackoverflow.com/a/31994428
read -p 'Branch to switch to: ' branch
for d in */; do cd $d; git stash; git checkout $branch; (git pull origin $branch); cd ..; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment