C.12 GitCheckoutTask

Checkout a branch or paths to the working tree. See official documentation.

Table C.13: Attributes

gitPathStringPath to Git binary/usr/bin/gitNo
repositoryStringPath to Git repositoryn/aYes
branchnameStringBranch to checkout. See <branch> in git-checkout.originNo
startpointStringThe name of a commit at which to start the new branch; Defaults to HEAD. See <start_point> in git-checkout. No
createBooleanCreate a new branch named <branchname> and start it at <startpoint>falseNo
forcecreateBooleanCreates 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".falseNo
mergeBooleanSee --merge in git-checkout.falseNo
trackBooleanSee --track in git-checkout.falseNo
notrackBooleanSee --no-track in git-checkout.falseNo
quietBooleanQuiet, suppress feedback messages. See --quiet in git-checkout.falseNo
forceBooleanWhen 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.falseNo

C.12.1 Example

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

                <!-- clone repository -->
                targetPath="${repo.dir.resolved}" />

                <!-- create and switch to "mybranch" branch -->
                branchname="mybranch" quiet="true" create="true" />

                <!-- get back to "master" branch -->
                branchname="master" quiet="true" />

                <!-- create (force) already created branch -->
                branchname="mybranch" quiet="true"
                forceCreate="true" />