[英]Git pull merge fetch
I'm trying to solve a problem with Git. 我正在尝试解决Git的问题。 I'm using TortoiseGit.
我正在使用TortoiseGit。
Basically I checked out the master-branch and without making any changes and now I want to do an update of my local repo. 基本上,我签出了主分支,没有进行任何更改,现在我想更新本地存储库。
As I understand there a few commands for this: 据我了解,对此有一些命令:
Fetch : Downloads info from the remote branch 提取 :从远程分支下载信息
Merge : Merges said info into the local branch 合并 :将说的信息合并到本地分支
Pull : Combines above operations 拉 :结合以上操作
However, there a few things that I see that I don't understand: 但是,有些事情我看不明白:
Am I misunderstanding the basics of Git, or could anyone explain this behavior to me? 我是在误解Git的基础,还是有人可以向我解释这种行为?
There could be many things that can be considered a change. 可能有很多事情可以被认为是改变。 First of all the equivalent of
git pull
is actually. 首先,等效于
git pull
实际上是。
git fetch
git merge FETCH_HEAD
Now, after you do this, you probably want to do git diff FETCH_HEAD
to see what is Git considering as a difference. 现在,执行
git diff FETCH_HEAD
此操作后,您可能想执行git diff FETCH_HEAD
来查看Git考虑的区别。 You might want to replace FETCH_HEAD to something more user friendly, like origin/master
. 您可能希望将FETCH_HEAD替换为更用户友好的名称,例如
origin/master
。
It could be line-endings, or it could be simply the modification time of the files, either way, if you want to get rid of your "modifications", you can do git reset --hard
which would reset all the work tree files to what they were in HEAD, and presumably you can do the pull now. 可能是行尾,也可能只是文件的修改时间,无论哪种方式,如果要摆脱“修改”,可以执行
git reset --hard
来重置所有工作树文件达到他们在HEAD中的状态,现在大概可以进行拉动了。
Alternatively, you can reset directly to the latest git reset --hard FETCH_HEAD
(or eg origin/master). 或者,您可以直接重置为最新的
git reset --hard FETCH_HEAD
(或例如origin / master)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.