I'm trying to solve a problem with Git. I'm using 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?
There could be many things that can be considered a change. First of all the equivalent of git pull
is actually.
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. You might want to replace FETCH_HEAD to something more user friendly, like 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.
Alternatively, you can reset directly to the latest git reset --hard FETCH_HEAD
(or eg origin/master).
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.