Skip to content

Commit efaaa06

Browse files
authored
Merge pull request #64 from unixorn/make-git-upstream-sync-configurable
Make git-upstream-sync use a configurable remote
2 parents a95633c + 0894587 commit efaaa06

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

bin/git-upstream-sync

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,18 @@
77
# Sync to upstream/yourforkname and rebase into your local fork. then push
88
# back into yourfork/yourforkname
99
#
10-
# Assumes that your upstream fork's remote is named upstream
10+
# Assumes that your upstream fork's remote is named upstream unless you
11+
# set upstream-sync.remote with git config
1112

1213
branch_name=$(git symbolic-ref --short -q HEAD)
14+
upstream_remote=$(git config --get upstream-sync.remote)
15+
# shellcheck disable=SC2181
16+
if [[ $? != 0 ]]; then
17+
echo 'Using default remote of upstream'
18+
upstream_remote='upstream'
19+
fi
1320

14-
git fetch upstream && \
15-
git rebase upstream/${branch_name} && \
21+
git fetch ${upstream_remote} && \
22+
git rebase "${upstream_remote}/${branch_name}" && \
1623
git push && \
1724
git fetch -p

0 commit comments

Comments
 (0)