C.20 GitMergeTask

Join two or more development histories together. See official documentation.

Table C.21: Attributes

NameTypeDescriptionDefaultRequired
gitPathStringPath to Git binary/usr/bin/gitNo
repositoryStringPath to Git repositoryn/aYes
remoteStringSpace separated list of branches to merge into current HEAD. See <commit> in git-merge.n/aNo
messageStringCommit message to be used for the merge commit (in case one is created). See <msg> in git-merge.n/aNo
fastForwardCommitBooleanIf set false (default), will not generate a merge commit if the merge resolved as a fast-forward, only update the branch pointer. If set true, will generate a merge commit even if the merge resolved as a fast-forward. See --ff/--no-ff options in git-merge.falseNo
strategyStringMerge strategy. One of "resolve", "recursive", "octopus", "ours", or "subtree". See <strategy> in git-merge.n/aNo
strategyOptionStringPass merge strategy specific option through to the merge strategy. See <strategy-option> in git-merge.n/aNo
commitBooleanSee --commit in git-merge.falseNo
nocommitBooleanSee --no-commit in git-merge.falseNo
quietBooleanQuiet, suppress feedback messages. See --quiet in git-merge.falseNo

C.20.1 Example

<property name="repo.dir" value="./relative/path/to/repo" />
<resolvepath propertyName="repo.dir.resolved" file="${repo.dir}" />

<!-- clone repository -->
<gitclone
    repository="git://github.com/path/to/repo/repo.git"
    targetPath="${repo.dir.resolved}" />

<!-- create couple of test branches -->
<gitbranch
    repository="${repo.dir.resolved}"
    branchname="merge-test-1" startpoint="origin/master" />
<gitbranch
    repository="${repo.dir.resolved}"
    branchname="merge-test-2" startpoint="origin/master" />

<!-- Merge those branches back into master -->
<gitmerge
    repository="${repo.dir.resolved}"
    remote="merge-test-1 merge-test-2"
    message="merging repos" commit="true" />