pguardiario
pguardiario

Reputation: 55002

Git pull and disregard merges

I'm having a problem with git where it won't let me push or pull because of 'unmerged changes'. I tried to git rm the local files that have a conflict thinking I could just pull the remote ones and redo the changes but that made things worse.

I'm getting:

CONFLICT (modify/delete): xxx deleted in HEAD and modified in 03907b23b68fb8337d12d784b4415c. Version 03907b23b68d3f94f87 of xxx left in tree.
Automatic merge failed; fix conflicts and then commit the result.

How do I fix this and avoid it in the future?

Upvotes: 0

Views: 496

Answers (1)

Nihathrael
Nihathrael

Reputation: 515

You can try using (THIS WILL DELETE ANY LOCAL CHANGES): git reset --hard HEAD to fully reset your working copy and index to HEAD in a pre-pull state. What this does is reset your entire repository to the HEAD state (you could specify any commit here), removing any merge information but also any local changes.

Read the docs to understand the details: https://www.kernel.org/pub/software/scm/git/docs/git-reset.html

Check this discussion for tips on merging with git to avoid problems in the future: How to resolve merge conflicts in Git?

Upvotes: 1

Related Questions