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?
- 1Does this help? stackoverflow.com/questions/5741407/…Mathew– Mathew2014-01-14 13:44:51 +00:00Commented Jan 14, 2014 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– Mohammad AbuShady2014-01-14 16:28:58 +00:00Commented Jan 14, 2014 at 16:28
- @Mohammed: yes, I want to overwrite my local files.user2718671– user27186712014-01-15 08:15:16 +00:00Commented Jan 15, 2014 at 8:15
1 Answer
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 pullnever 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.