I have a bare Git repository. Let's say I have some content in branch master
and the head is pointing at commit "C1".
test.txt
at C1 contains
line-1
Now, I create a new branch ref R1
and add a new commit C11
with its parent commit being C1
(head of R1
).
test.txt
at C11 contains
line-1
line-2
line-3
I pulled master
and see that a new commit C2 is added.
It contains test.txt
as
line-1
line-2
Now, I want to merge C2 with C11 and create a new commit.
The issue I am facing is while merging.
I think this should auto-merge without any conflicts.
To merge:
Merger merger = MergeStrategy.RECURSIVE.newMerger(git.getRepository(), true);
merger.merge('C2', 'C11');
Here, the merge result is conflicted. But ideally, it should have been a non-conflicting auto-merge.
The JGit API for merging org.eclipse.jgit.merge.MergeAlgorithm#merge
has the following input:
base
line-1
ours
line-1
line-2
theirs
line-1
line-2
line-3
What could be missing here / Anything special needs to be done while merging for bare repositories? Thanks.