Track remote branches

Study notes, transferred from: http://git.oschina.net/progit/3-Git-%E5%88%86%E6%94%AF.html#3.4-%E5%88%A9%E7%94%A8 %E5%88%86%E6%94%AF%E8%BF%9B%E8%A1%8C%E5%BC%80%E5%8F%91%E7%9A%84%E5%B7%A5%E4 %BD%9C%E6%B5%81%E7%A8%8B

 

Track remote branches

checkout A local branch that is  branched from a remote  is called a tracking  branch. A tracking branch is a local branch that has a direct connection to a remote branch. Type in the tracking branch,  git pushand Git will figure out which branch on which server to push data to. Again, running in these branches  git pull will fetch all remote indexes and merge their data into the local branch.

When cloning a repository, Git usually automatically creates a  master branch  called origin/master. That's exactly  why git push and  git pull works fine in the first place. Of course, you can set other tracking branches as you like, such as  other branches other origin than  master the ones above. We have just seen an example of this: git checkout -b [分支名] [远程名]/[分支名]. If you have Git version 1.6.2+, you can also  --track simplify with options:

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325341521&siteId=291194637