Skip to content
Merged
Show file tree
Hide file tree
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
20 changes: 15 additions & 5 deletions tools/git-submit
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,22 @@

set -eu

BRANCH=$1
REMOTE=""
BRANCH="${1-master}"

if (echo "$BRANCH" | grep ':' > /dev/null); then
REMOTE="$(echo "$BRANCH" | grep -o '^[^:]*')"
BRANCH="$(echo "$BRANCH" | grep -o '[^:]*$')"
REMOTE="$(git remote -v | grep ":$REMOTE/.* (push)" | grep -o '^\S*')"
fi

if [ -n "$REMOTE" ]; then
git checkout --track "$REMOTE/$BRANCH"
else
git checkout $BRANCH
fi

git checkout "$BRANCH"
git push upstream "$BRANCH:master"
git checkout master
git merge upstream/master
git push
git sync
git branch -d "$BRANCH"
git push origin ":$BRANCH"
1 change: 0 additions & 1 deletion tools/git-sync
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ case "$BRANCH" in
else
git checkout $BRANCH
fi
git checkout $BRANCH
git rebase upstream/master
;;
esac
Expand Down