Following problem: I want to get the files from the git repository to my local test server. But there were many old files on my test server. git pull didn't work and caused that merge conflicts so I tried to delete all my local files and wanted to try it again. But even if the conflicting files doesn't exist anymore the merge conflicts still exist. How to solve them? I tried to display and open the files with git diff --name-only --diff-filter=U
vi filename - but I can't solve it that way because the files doesn't exist anymore. Any suggestions?

- 2,866
- 9
- 49
- 86
-
1Does this help? http://stackoverflow.com/questions/5741407/how-to-undo-a-git-merge-with-conflicts – Mathew Jan 14 '14 at 13:44
-
I don't know what exactly do you want, do u want to overwrite your local files? or do you want to download the remote files without overwriting the local? or what? – Mohammad AbuShady Jan 14 '14 at 16:28
-
@Mohammed: yes, I want to overwrite my local files. – user2718671 Jan 15 '14 at 08:15
1 Answers
Information about git conflicts is stored in the index, not the work tree. They are resolved by adding, with
git add
, the resolved content. It follows that deleting local files won't have any effect.git pull
never generates conflict with local files. It will complain that your work directory is not clean instead. Deleting local files therefore won't help (if you did it before runninggit pull
, it would cause it to complain the working directory is not clean and not do anything).Therefore the conflict is between the branch that was checked out before and the branch you want to pull.
I suppose you want to have the exact content that you pulled, right? In that case
`git reset --hard origin/master`
should be the fastest way. It tells git to check out the content of the branch master
pulled from origin
(adjust appropriately if you are using different branch), overwriting any previous content of the working tree, and make the current branch point to that revision.

- 73,652
- 13
- 125
- 172
-
Yeah, that helped! Thx for your help and your well structured answer! – user2718671 Jan 15 '14 at 08:16