Git and branches
ok so apparently to create a new git branch on the remote repository we need:
git push origin origin:refs/heads/sandbox
git fetch origin
git checkout --track -b sandbox origin/sandbox
git pull
Now if I want to switch back to the master branch I can just do
git checkout master
If I want to switch back to sandbox after going back to master, do I need
git checkout --track -b sandbox origin/sa开发者_StackOverflowndbox
or just
git checkout sandbox
git checkout sandbox
will work. When you did the checkout -b sandbox origin/sandbox
, you set up a local branch named sandbox
which will track the remote origin/sandbox
. To get the latest changes from upstream into your local copy, do git pull
when on the sandbox
branch.
精彩评论