I've been discussing with my team and searching the internet, but I cannot figure out how to create a new git branch locally based on a remote branch hosted on GitHub. It seems like there should be a way to do this.
I've tried the following, but when I push, it pushes to the incorrect (origin/release/1.0) branch instead of pushing to a new branch (feature/123) on GitHub.
git checkout -b feature/123 origin/release/1.0
Currently, the workflow that works is:
git checkout release/1.0
git pull
git checkout -b feature/123
I have to do that quite a bit though and it feels like I should be able to skip having to pull in the release/1.0 branch locally, and instead, create my branch with one command.
Is there a way to do this, or do we have to just keep pulling in the latest release and then branching from there locally?
Solution
Update global git config
git config --global branch.autoSetupMerge false
Create new branch from latest release
$ git fetch --all
$ git checkout -b feature/123 origin/release/1.0
$ git push --set-upstream origin feature/123