Class DeleteBranchCommand

  • All Implemented Interfaces:
    java.util.concurrent.Callable<java.util.List<java.lang.String>>

    public class DeleteBranchCommand
    extends GitCommand<java.util.List<java.lang.String>>
    Used to delete one or several branches. The result of call() is a list with the (full) names of the deleted branches. Note that we don't have a setter corresponding to the -r option; remote tracking branches are simply deleted just like local branches.
    See Also:
    Git documentation about Branch
    • Field Detail

      • branchNames

        private final java.util.Set<java.lang.String> branchNames
      • force

        private boolean force
    • Constructor Detail

      • DeleteBranchCommand

        protected DeleteBranchCommand​(Repository repo)
        Constructor for DeleteBranchCommand
        Parameters:
        repo - the Repository
    • Method Detail

      • setBranchNames

        public DeleteBranchCommand setBranchNames​(java.lang.String... branchnames)
        Set the names of the branches to delete
        Parameters:
        branchnames - the names of the branches to delete; if not set, this will do nothing; invalid branch names will simply be ignored
        Returns:
        this instance
      • setForce

        public DeleteBranchCommand setForce​(boolean force)
        Set whether to forcefully delete branches
        Parameters:
        force - true corresponds to the -D option, false to the -d option (default)
        if false a check will be performed whether the branch to be deleted is already merged into the current branch and deletion will be refused in this case
        Returns:
        this instance