special points about git

1 about "origin/master tracks the remote branch"

1.1 what does tracking mean?

after "git clone", local "master" branch atomatically tracks the remote "origin/master" branch. thus, "git pull master" will fetch the "origin/master" branch it tracks and merge the data to itself. If no such tracking relationship, when we pull, we should use "git pull <远程主机名> <远程分支名>:<本地分支名>".

1.2 what is the remote branch?

it is the branch in the server. We use it to fetch the other's commits.

1.3 if the remote branch receives a commit, what is the effect to "origin/master"

if you don't fetch, the local "origin/master" will not change. but if you fetch, "origin/master" will point to the newest commit on the server.

1.4 what is the "origin/master" branch?

It is a remote branch. "origin" is the default remote repository's name, and master is the default branch name of the remote branch.

We fetch the "origin/master" to get the codes commited by the others. Thus, we need this remote branch.

 

2 difference between git pull and git fetch

2.1 git pull

fetch the new data from the server and merge it with the specified branch.

git fetch

only fetch the new data from the server, but not merge. the data is stored in the local repository, but not merged into the current branch. and the data will no dirty the working copy.

he take away is to keep in mind that there are often at least three copies of a project on your workstation. One copy is your own repository with your own commit history. The second copy is your working copy where you are editing and building. The third copy is your local "cached" copy of a remote repository.

 

posted @ 2017-02-25 15:45  PhoenixTree(梧桐树)  阅读(214)  评论(0编辑  收藏  举报