sunmingtao / sample-code

3 stars 4 forks source link

How to checkout an existing branch #68

Closed sunmingtao closed 4 years ago

sunmingtao commented 4 years ago

Normally I'd do, under master branch

git checkout -b existing-branch
git pull origin existing-branch

But this only works when the existing-branch is ahead of master. What if the existing-branch is behind master?

sunmingtao commented 4 years ago
git fetch
git checkout --track origin/existing-branch