Quick one today guys…
I need to setup a local branch to track the latest on a remote branch on github. An easy way to do that is:
git checkout -b snowden --track origin/snowden
Basically, it says we are going to switch to branch “snowden” after we create it with the “-b” command. Then we are going to have that branch track the remote version we have on “origin”. So in this case track the remote “snowden” branch.
That’s it, super simple.
On a side note, if you find that you are unable to merge these branches to master and have unexpected results. You need to use a merge strategy that exactly copies the branch to master, instead of a downstream version. To do that:
git checkout snowden git merge -s ours master git checkout master git merge snowden