🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
# C.16 GitCheckoutTask Checkout a branch or paths to the working tree. See official [documentation](http://www.kernel.org/pub/software/scm/git/docs/git-checkout.html). Table C.17:聽Attributes NameTypeDescriptionDefaultRequired`gitPath``String`Path to Git binary/usr/bin/gitNo`repository``String`Path to Git repositoryn/aYes`branchname``String`Branch to checkout. See <branch> in [git-checkout](http://www.kernel.org/pub/software/scm/git/docs/git-checkout.html).originNo`startpoint``String`The name of a commit at which to start the new branch; Defaults to HEAD. See <start\_point> in [git-checkout](http://www.kernel.org/pub/software/scm/git/docs/git-checkout.html).聽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](http://www.kernel.org/pub/software/scm/git/docs/git-checkout.html).`false`No`track``Boolean`See --track in [git-checkout](http://www.kernel.org/pub/software/scm/git/docs/git-checkout.html).`false`No`notrack``Boolean`See --no-track in [git-checkout](http://www.kernel.org/pub/software/scm/git/docs/git-checkout.html).`false`No`quiet``Boolean`Quiet, suppress feedback messages. See --quiet in [git-checkout](http://www.kernel.org/pub/software/scm/git/docs/git-checkout.html).`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](http://www.kernel.org/pub/software/scm/git/docs/git-checkout.html).`false`No C.16.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 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" /> ```