How to prevent git merge to merge a specific file from trunk into a branch and vice versa

Posted by svenn on Stack Overflow See other posts from Stack Overflow or by svenn
Published on 2009-04-21T15:36:11Z Indexed on 2010/06/11 5:12 UTC
Read the original article Hit count: 306

Filed under:

Hi, I am using git while developing VHDL code. I am doing development on a component in a git branch: comp_dev. The component interface does not change, just the code inside the component. Now, this component already exists in the master branch, but in a more stable version, enough for other developers to be able to use the component. The other developers also have branches for their work, and when their code is good they merge their branches back to master.

At this stage I need to be able to merge all the changes from master back to my comp_dev branch, which is basically no problem, but sometimes the stable version of the component I am working on do change as a part of other designers work, but not the interface. I have to do manual git merge -s ours on that particular file every time I want to merge, otherwise I get a conflict that I need to solve manually, throwing out their work.

The same happens if I want to merge changes in other files back to master. If I forget to do git merge -s ours src/rx/state_machine.vhd comp_dev before I do a git merge, then I end up with either a manual merge, or I accidentally merge an unstable version of the state machine on top of the stable one.

Is there a way to temporarily exclude one file from merges?

© Stack Overflow or respective owner

Related posts about git