Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions bin/git-upstream-sync
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,18 @@
# Sync to upstream/yourforkname and rebase into your local fork. then push
# back into yourfork/yourforkname
#
# Assumes that your upstream fork's remote is named upstream
# Assumes that your upstream fork's remote is named upstream unless you
# set upstream-sync.remote with git config

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

git fetch upstream && \
git rebase upstream/${branch_name} && \
git fetch ${upstream_remote} && \
git rebase "${upstream_remote}/${branch_name}" && \
git push && \
git fetch -p