From 000571b51af47ef435bbdd71a767dd30f6a79f35 Mon Sep 17 00:00:00 2001 From: Wei He Date: Sat, 18 Apr 2020 13:36:42 -0400 Subject: [PATCH] fix: support branch other than master (#9) 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