I have a site local repo and a remote repo. Local repo contains the 1-2 month old content of remote repo.
I try to pull the whole content into local repo.
git pull origin master
From ssh://.../site.git
* branch master -> FETCH_HEAD
...
CONFLICT (add/add): Merge conflict in admin/process_email.php
Automatic merge failed; fix conflicts and then commit the result.
I checked process_email.php using P4Merge, but shows no conflict, furthermore there were no changes at all, no difference.
UPDATE:
I get
$ git status
On branch master
nothing to commit, working directory clean on both repos.
Also I tried
$ git pull -X theirs origin/master master
But still get the same error.
I want to merge the remote origin repo with my local repo. I want to overwite local repo with remote origin repo content as the remote repo is newer, contains the latest code.
More than 2000 files are conflicting, while I checked the conflict and they have the same content. I would not want to do manual conflict handling.
I have autocrlf = False in the .gitconfig.
Why do I get conflict error for files, which have exactly the same content?
Often, merge conflicts happen when people make different changes to the same line of the same file, or when one person edits a file and another person deletes the same file. You must resolve all merge conflicts before you can merge a pull request on GitHub.
Finally solved the problem, based on solution used in following thread:
How to handle/fix git add/add conflicts?
# moved all files from the local workdir to another directory.
mv /workdir/* /old_content
# commit this change
git commit -m 'Resolve git Add/Add branch merge conflict by deleting conflicted folder and files in myconflictedfolder'
# do merge from remote
git pull origin master
Pull was executed successfully, no conflicts anymore.
I could now overwrite the old_content directory, if I want, then commit.
Best regards, Konrad
This can also occur if someone has forced push on the remote. Quick fix is to reset hard on your local and then take pull
git reset --hard origin/master
git pull
Also one should avoid git force push.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With