13 lines
463 B
Bash
Executable File
13 lines
463 B
Bash
Executable File
#!/bin/sh -e
|
|
# set repo as origin and set all branches upstream to a corresponding remote branch, if available
|
|
remote="${4:-origin}"
|
|
git remote $(case "$(git remote)" in
|
|
(*"$remote"*) echo set-url;;
|
|
(*) echo add;;
|
|
esac) "$remote" "$(git-repo "$@")"
|
|
git remote -v && git fetch --all
|
|
|
|
git branch --format='%(refname:short)' | while read branch
|
|
do test $(git branch --all | grep "$remote/$branch" | wc -l) -gt 0 && git branch -u "$remote/$branch" "$branch"
|
|
done
|