Checkout a branch or paths to the working tree. See official documentation.
Table C.13: 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 | Branch to checkout. See <branch> in git-checkout. | origin | No |
startpoint | String | The name of a commit at which to start the new branch; Defaults to HEAD. See <start_point> in git-checkout. | No | |
create | Boolean | Create a new branch named <branchname> and start it at <startpoint> | false | No |
forcecreate | Boolean | Creates the branch <branchname> and start it at <startpoint>; if it already exists, then reset it to <startpoint>. This is equivalent to running "git branch" with "-f". | false | No |
merge | Boolean | See --merge in git-checkout. | false | No |
track | Boolean | See --track in git-checkout. | false | No |
notrack | Boolean | See --no-track in git-checkout. | false | No |
quiet | Boolean | Quiet, suppress feedback messages. See --quiet in git-checkout. | false | No |
force | Boolean | When switching branches, proceed even if the index or the working tree differs from HEAD. This is used to throw away local changes. See --force in git-checkout. | false | No |
<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 and switch to "mybranch" branch -->
<gitcheckout
repository="${repo.dir.resolved}"
branchname="mybranch" quiet="true" create="true" />
<!-- get back to "master" branch -->
<gitcheckout
repository="${repo.dir.resolved}"
branchname="master" quiet="true" />
<!-- create (force) already created branch -->
<gitcheckout
repository="${repo.dir.resolved}"
branchname="mybranch" quiet="true"
forceCreate="true" />