I am writing an application that automates the re-building of a branch based on a new head. It uses cherry-picking to get the job done, but many times the app runs into merge commits that have 2 parents. When I do:
_ngit.CherryPick().Include(commit).Call();
...it throws an exception, Cannot cherry-pick commit '{commit_id}' because it has 2 parents, only commits with exactly one parent are supported.
I need the ability to cherry-pick these merge commits, selecting the first parent as the base. Seems like there would be something like:
_ngit.CherryPick().Include(commit).WithBase(0).Call();
(where 0
is the index of the first parent that I want to use as a base)
I've seen various hints on the web where people trying to get this ability added to jgit, but I've never seen any documentation or anything in the API that suggests it's available. Some such "hints" are:
- Patch to egit in 2011
- Another patch in 2011 that looks like it made it into egit, but not sure jgit
- Patch to jgit in 2012
If this is possible with jgit, please tell me how. If there's another way to get these merge commits added into my new branch, I'm all ears.