Pretty new to git and have a bit of an issue i'm not sure how to fix. I mistakenly made a change to one file in a working copy and didn't commit the change. I then made changes to another copy and committed them - when I tried to pull the changes I unsurprisingly got an error saying my "local changes to the file would be overwritten by merge, aborting". So I removed the offending file using git rm, then used git add -u and committed the deletion. I then tried to pull in the latest copy and got the following. What's the best way to deal with this? grateful for any pointers

CONFLICT (delete/modify): wp-content/plugins/wp-flash-countdown/xml_option_.xml deleted in HEAD and modified in ba878ab1efe3a039961a446c490d5c93a2bc22e1. Version ba878ab1efe3a039961a446c490d5c93a2bc22e1 of wp-content/plugins/wp-flash-countdown/xml_option_.xml left in tree. Automatic merge failed; fix conflicts and then commit the result. 
1

3 Answers

If you now do git status, its output contains:

# Unmerged paths: # (use "git add/rm <file>..." as appropriate to mark resolution) 

If you git rm them, a needs merge warning will be output but nevertheless the removal will succeed, then you can commit the modifications - this will be the "merge commit".

SO at this point do you have the file in the working copy that you pulled to?

if so just delete it and recommit.

3

Had a similar problem with a cheesy WordPress host. Try this..

git log --follow -- readme.html 

Note the commit id of the last time that file existed (like before you deleted it.) Now you want to "checkout" that file from git.

git checkout (commit id) readme.html 

Then add, commit, push, etc. Worked for me!

1

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy