From a6e91090b9c468f59b771e160ff55ba8cd53c345 Mon Sep 17 00:00:00 2001 From: Wei He Date: Sat, 18 Apr 2020 13:33:05 -0400 Subject: [PATCH] fix: support branch other than master Fix #7 --- git-sync.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/git-sync.sh b/git-sync.sh index a352c6d..b87ab8e 100755 --- a/git-sync.sh +++ b/git-sync.sh @@ -33,4 +33,11 @@ echo "DESTINATION=$DESTINATION_REPO:$DESTINATION_BRANCH" git clone "$SOURCE_REPO" source --origin source && cd source git remote add destination "$DESTINATION_REPO" + +# Pull all branches references down locally so subsequent commands can see them +git fetch source '+refs/heads/*:refs/heads/*' --update-head-ok + +# Print out all branches +git --no-pager branch -a -vv + git push destination "${SOURCE_BRANCH}:${DESTINATION_BRANCH}" -f