I need support of 3 versions of my program. Where most files are
joint (common) but several files contain different content for each version.
I'll probably use 4 branches A,B,C,D in Git.
Form example project Ice-cream:
____________________________________________________
Cup.txt: { Waffle cup } – common file for all version
Filling.txt { banana } - special file for B version
Filling.txt { strawberries } - special file for C version
Filling.txt { vanilla } - special file for D version
____________________________________________________
A - branch suitable only for global files (Cup.txt)
B,C,D - branch suitable only for Filling.txt file.
For this strategy I need allow to merge only in one direction: A => B,C,D
My question is how to forbid merging from B,C,D to A branches in Git?

Regarding source code, it is best to avoid complex merge strategy, and modify PrintBill in order to:
The idea is the same than the one initially written below: avoid any complex merge strategy.
Now if that kind of refactoring isn't possible, you can try and declare a merge driver, but that won't be always called (only in case of conflicts)
Another approach would be to avoid versioning Filling.txt (that way, no more merge strategy headache).
You can:
smudge script (a content filter driver declare in a .gitattributes file) which will automatically on checkout generate, depending on the checked out branch, the right Filling.txt
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