2021-09-20 06:57:20 +00:00
|
|
|
#!/bin/sh -e
|
2021-06-18 15:51:57 +00:00
|
|
|
# set repo as origin and set all branches upstream to a corresponding remote branch, if available
|
2022-03-25 08:14:30 +00:00
|
|
|
remote="${4:-origin}"
|
2021-10-14 18:25:44 +00:00
|
|
|
git remote $(case "$(git remote)" in
|
2022-03-25 08:14:30 +00:00
|
|
|
(*"$remote"*) echo set-url;;
|
2021-10-14 18:25:44 +00:00
|
|
|
(*) echo add;;
|
2022-03-25 08:14:30 +00:00
|
|
|
esac) "$remote" "$(git-repo "$@")"
|
2021-09-20 06:57:20 +00:00
|
|
|
git remote -v && git fetch
|
2021-06-18 15:51:57 +00:00
|
|
|
|
2021-10-14 18:25:44 +00:00
|
|
|
git branch --format='%(refname:short)' | while read branch
|
2022-03-25 08:14:30 +00:00
|
|
|
do test $(git branch -a | grep $remote/$branch | wc -l) -gt 0 && git branch -u $remote/$branch $branch
|
2021-06-18 15:51:57 +00:00
|
|
|
done
|