Dave
Dave

Reputation: 8897

git: How do I programatically detect conflicts in multiple branches?

We're using Git 1.7.4.1. Given multiple branches with names BRANCH_1, BRANCH_2, ... BRANCH_N, is there a programmatic/scriptable way to tell what conflicts will exist if we want to merge all of these? You can assume that we do not have any local repository set up. Right now, I'm on a Mac 10.6.6, using bash shell.

Thanks, - Dave

Upvotes: 2

Views: 257

Answers (1)

Brian Campbell
Brian Campbell

Reputation: 332736

No, the only way to tell what will happen is if you create a local repository and actually try doing the merge. There are multiple different ways you could merge all of the branches together, and the results depend on which one you use; and the merge process may not be simple if you have a complicated history.

It's pretty easy to create a throwaway local repository and try merging in it. That's what the linux-next tree does for the Linux kernel; it fetches and tries merging a whole bunch of different maintainers' trees, keeping a log as it does so, skipping failed merges (it looks, from the log, like it might try to resolve some of them or just go on even when merges fail, so I don't know the exact policy) and notifying the maintainers of the trees in question. You can then check out the results of that and test them, or test that your code will merge against the merge of all of the different branches, or whatever.

Upvotes: 1

Related Questions