Skip to content

Commit d38a6ae

Browse files
authored
Merge pull request #793 from unixorn/tweak-upstream-sync
Improve default remote detection
2 parents 9e2d405 + aa4531d commit d38a6ae

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

bin/git-upstream-sync

+6-5
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,14 @@
1212

1313
branch_name=$(git symbolic-ref --short -q HEAD)
1414
upstream_remote=$(git config --get upstream-sync.remote)
15+
1516
# shellcheck disable=SC2181
1617
if [[ $? != 0 ]]; then
17-
echo 'Using default remote of upstream'
18-
upstream_remote='upstream'
18+
if [[ -n "$upstream_remote" ]]; then
19+
upstream_remote=$(git remote show | head -1)
20+
fi
1921
fi
2022

21-
git fetch "${upstream_remote}" && \
23+
git fetch "${upstream_remote}" -p && \
2224
git rebase "${upstream_remote}/${branch_name}" && \
23-
git push && \
24-
git fetch -p
25+
git push

0 commit comments

Comments
 (0)