Last active
August 12, 2020 16:20
-
-
Save nibble-4bits/2060b83c119aacd3ab1d4137920e1e81 to your computer and use it in GitHub Desktop.
A bash script to pull all outdated git branches
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
git fetch > /dev/null | |
CURRENT_BRANCH=$(git branch --show-current) | |
OUTDATED_BRANCHES=$(git branch -v | grep 'behind' | tr -d '*' | awk '{ print $1 }') | |
for BRANCH in $OUTDATED_BRANCHES | |
do | |
git checkout "$BRANCH" | head -1 | |
git pull | |
echo | |
done | |
git checkout "$CURRENT_BRANCH" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment