github 同步当地仓库见上一篇总结 chensong212.github.io/2020/11/21/summary/
This summary explain how to switch branch using git checkout, and deal with a remote branch.
1. Enter the main directory, check the branches
$ git branch
3. Build a new branch
If the destination branch does not exist, you have to append the “-b” option, otherwise you won’t be able to switch to that branch.
$ git checkout -b “name of new_branch”
3. Switch the branch
$ git checkout “name of branch”
4. Git Checkout a Remote Branch
In order to checkout a remote branch you have to first fetch the contents of the branch.
$ git fetch –all
5. Commit the changes
$ git commit -m “some description of the modification” “name of file”
6. Set the upstream origin
$ git push –set-upstream origin “name of branch”
7. Push to the remote branch
$ git push