Git Commands Quick Notes


This command is to make sure your local repository has the same knowledge of the remote-tracking branches as the server.

git fetch <remote name>

Check out a Remote Branch

If a new remote branch doesn't have a local branch mapped to it, you need to check out the remote branch locally to work on it. The complete command is,

git checkout -b <local branch name> <remote name>/<remote branch name>

If you want to fetch  all the branches on the server

git branch -v -a



Push changes to remote. (If the remote doesn't have the branch, the branch will be created)

git push <remote name> <branch name>


Renaming a branch (a complete version of push command)

This can delete a  remote branch by providing empty local branch name.

git push <remote name> <local branch name>:<remote branch name>



posted @ 2016-07-01 09:41  quanben  阅读(124)  评论(0编辑  收藏  举报