Re: git pull (Your local changes to ... would be overwritten by merge)
- From
Michael J Gruber <git@drmicha.warpmail.net>
- Date
- Jun 17, 2010, 10:42 UTC
- Message-ID
- <4C19FBF8.6010709@drmicha.warpmail.net>
- In-Reply-To
- <AANLkTimeIWseETfYiMajIqesjJ_p55pRislnQQIaCrbG@mail.gmail.com>
Daniel Blendea venit, vidit, dixit 17.06.2010 11:35:
Show 13 quoted lines
> Hello, > > A while ago I have cloned on my computer a git repo. > Since then, the developers have modified several files in the repo. > Now I want to update my copy with the latest changes. > > I do 'git pull' but I get 'Your local changes to .... would be > overwritten by merge. Aborting.' > I didn't modified any local file. I tried using 'git stash save' but no luck. > > How can I make git update and override my local copy? > With all the fuss about it, I thought I will handle this operation > pretty easily.
If you are sure you have no own modifications which you would miss:
git fetch --all git reset --hard origin/master
Fetch is pull without trying to merge or rebase anything. the send line resets your master branch to what you just fetched.
Most likely the remote side did a non-forward push and brought you in that situation.
[Which, on a side note, is one reason why I still believe that git should not create any local branch for a clone. git fetch && git checkout origin/master does not suffer from this issue.]
Michael