1

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?

3
  • 1
    Does this help? stackoverflow.com/questions/5741407/… Commented 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? Commented Jan 14, 2014 at 16:28
  • @Mohammed: yes, I want to overwrite my local files. Commented Jan 15, 2014 at 8:15

1 Answer 1

2
  1. 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.

  2. 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 running git pull, it would cause it to complain the working directory is not clean and not do anything).

  3. 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.

Sign up to request clarification or add additional context in comments.

1 Comment

Yeah, that helped! Thx for your help and your well structured answer!

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.