Created
September 21, 2017 08:13
-
-
Save timimsms/452f38b9b61eea3e3ed2d47f73d67ce8 to your computer and use it in GitHub Desktop.
Stash all branches listed in a provided file to a personal fork.
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
#!/usr/bin/env bash | |
#:https://stackoverflow.com/a/10929511 | |
# | |
# Use: Stashing all branches listed in `to_stash.txt` in remote `timimsms` | |
# | |
# > ./git-fork-stash.sh to_stash.txt timimsms | |
# | |
[ -z "$1" ] && echo "Warning: No file provided. Exiting" && exit 1 | |
[ -z "$2" ] && echo "Warning: No fork provided. Exiting" && exit 1 | |
echo "Stashing all branches listed in $1 to $2..." | |
while IFS='' read -r line || [[ -n "$line" ]]; do | |
git checkout $line; | |
git pull origin $line; | |
git push $2 $line; | |
done < "$1" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment