Cali0707 / git-utils

A collection of useful git tools
Apache License 2.0
4 stars 3 forks source link

Support no local checkout of main/master branch in git sync #15

Closed Cali0707 closed 1 year ago

Cali0707 commented 1 year ago

We currently are assuming that the user has a local checkout of main/master. This can lead to issues (as experienced by @inesqyx) where the script throws a lot of warnings/errors. We should update the script to:

  1. Check if there is a local copy of the branch `git branch -l "${BRANCH}"
  2. If not, run git checkout --track "origin/${BRANCH}" to get a copy of the branch