ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
# C.15 GitBranchTask Create, move or delete repository branches. See official [documentation](http://www.kernel.org/pub/software/scm/git/docs/git-branch.html) (branch listing functionality is omitted in current implementation). Table C.16:聽Attributes NameTypeDescriptionDefaultRequired`gitPath``String`Path to Git binary./usr/bin/gitNo`repository``String`Path to Git repository.n/aYes`branchname``String`The name of the branch to create or delete.n/aYes`newbranch``String`The new name for an existing branch.n/aYes, 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](http://www.kernel.org/pub/software/scm/git/docs/git-branch.html).聽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](http://www.kernel.org/pub/software/scm/git/docs/git-branch.html).聽No`track``Boolean`See --track option of [git-branch](http://www.kernel.org/pub/software/scm/git/docs/git-branch.html).`false`No`notrack``Boolean`See --no-track option of [git-branch](http://www.kernel.org/pub/software/scm/git/docs/git-branch.html).`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 C.15.1 Example ``` <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" /> ```