Create, move or delete repository branches. See official documentation (branch listing functionality is omitted in current implementation).
Table C.18: Attributes
| Name | Type | Description | Default | Required |
|---|---|---|---|---|
gitPath | String | Path to Git binary | /usr/bin/git | No |
repository | String | Path to Git repository | n/a | Yes |
branchname | String | The name of the branch to create or delete. | n/a | Yes |
newbranch | String | The new name for an existing branch. | n/a | Yes, if branch move invoked |
startpoint | String | The new branch head will point to this commit. It may be given as a branch name, a commit-id, or a tag. If this option is omitted, the current HEAD will be used instead. See <start-point> argument of git-branch. | No | |
setupstream | String | If specified branch does not exist yet or if --force has been given, acts exactly like --track. Otherwise sets up configuration like --track would when creating the branch, except that where branch points to is not changed. See --set-upstream option of git-branch. | No | |
track | Boolean | See --track option of git-branch. | false | No |
notrack | Boolean | See --no-track option of git-branch. | false | No |
force | Boolean | Reset <branchname> to <startpoint> if <branchname> exists already. Without -f git branch refuses to change an existing branch. | false | No |
move | Boolean | Move/rename a branch and the corresponding reflog. | false | No |
forcemove | Boolean | Move/rename a branch even if the new branch name already exists. | false | No |
delete | Boolean | Delete a branch. The branch must be fully merged in its upstream branch, or in HEAD if no upstream was set with --track or --set-upstream. | false | No |
forcedelete | Boolean | Delete a branch irrespective of its merged status. | false | No |
<property name="repo.dir" value="./relative/path/to/repo" />
<resolvepath propertyName="repo.dir.resolved" file="${repo.dir}" />
<!-- Initialize normal repository -->
<gitinit repository="${repo.dir.resolved}" />
<!-- Create branch "sample-branch" tracking current HEAD -->
<gitbranch
repository="${repo.dir.resolved}"
branchname="sample-branch" />
<!--
Create branch "sample-branch" tracking origin/master
Note that you can omit both startpoint and track attributes in this case
-->
<gitbranch
repository="${repo.dir.resolved}"
branchname="sample-branch"
startpoint="origin/master"
track="true" />
<!-- Delete fully merged branch "sample-branch" -->
<gitbranch
repository="${repo.dir.resolved}"
branchname="sample-branch"
delete="true" />
<!-- Force delete even unmerged branch "sample-branch" -->
<gitbranch
repository="${repo.dir.resolved}"
branchname="sample-branch"
forcedelete="true" />
<!-- Renabe "branch1" to "branch2" -->
<gitbranch
repository="${repo.dir.resolved}"
branchname="branch1"
newbranch="branch2"
move="true" />