Reborn Reborn - 3 months ago 23
Git Question

Make unable to branch merge [Lock for merge?]

I was wondering, if it's possible to make branches unable to merge?
For Example: I have

. I'm currently working on branch
which is completetely different from the other branches. How to make this branch unable to merge with others?

My bad, if it's a duplicate question.


If the branches are completely different then what you need is a completely separate repository, or a fork if you're using GitHub and the branch in question is at least similar to the other.

A rather ugly workaround would be a hook. There's no pre-merge hook but there is a prepare-commit-msg hook (link to SO answer about pre-merge hooks) which receives an argument that would give you what you'd need to write a script that checks the name of the branch. It'd be ugly. I'm not 100% sure it would work. Realistically, you should go with the first option. If the two branches can never be merged they should be in separate repositories.