tags:

views:

74

answers:

2

I've been using git for a while, and I understand why merge conflicts happen and that I need to make the final decision between two conflicting blocks of code.

However, I want to find a way to fix merge conflicts without git modifying the conflicting files. For example, if there are merge conflicts in a Django template or HTML file when I pull from dev into prod, the conflict lines go live on my site.

In most cases, merging is not actually what I want for a lot of HTML content I have. I usually prefer only one version of the two conflicting files.

Is there a way to achieve this?

+3  A: 

For example, if there are merge conflicts in a Django template or HTML file when I pull from dev into prod, the conflict lines go live on my site.

Why would merge occur in production? Don't do that. If you ever considered doing it, merge using a new branch, then push to production.

In most cases, merging is not actually what I want for a lot of HTML content I have. I usually prefer only one version of the two conflicting files.

To overwrite files/directories on your local copy, use:

git checkout <from_branch> <path1> <path2> ....

jweyrich
Thanks. I know about git checkout but doing that as a substitute for git pull seems like a pain. I'll try messing around with new branches for a merge.
Max
A: 

Could you run git pull on your production server with the --ff-only flag? That would ensure that you've already made the new changes apply cleanly on top of whatever your production server already has.

Greg Hewgill