首页 > 其他 > 详细

special points about git

时间:2017-02-25 17:00:32      阅读:225      评论:0      收藏:0      [点我收藏+]

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.

技术分享

 

special points about git

原文:http://www.cnblogs.com/hustdc/p/6441981.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!