Class ListBranchCommand

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

    public class ListBranchCommand
    extends GitCommand<java.util.List<Ref>>
    Used to obtain a list of branches.

    In case HEAD is detached (it points directly to a commit), it is also returned in the results.

    See Also:
    Git documentation about Branch
    • Constructor Detail

      • ListBranchCommand

        protected ListBranchCommand​(Repository repo)
        Parameters:
        repo -
    • Method Detail

      • call

        public java.util.List<Ref> call()
                                 throws GitAPIException
        Description copied from class: GitCommand
        Executes the command
        Specified by:
        call in interface java.util.concurrent.Callable<java.util.List<Ref>>
        Specified by:
        call in class GitCommand<java.util.List<Ref>>
        Returns:
        T a result. Each command has its own return type
        Throws:
        GitAPIException - or subclass thereof when an error occurs
      • setListMode

        public ListBranchCommand setListMode​(ListBranchCommand.ListMode listMode)
        Parameters:
        listMode - optional: corresponds to the -r/-a options; by default, only local branches will be listed
        Returns:
        this instance
      • setContains

        public ListBranchCommand setContains​(java.lang.String containsCommitish)
        If this is set, only the branches that contain the specified commit-ish as an ancestor are returned.
        Parameters:
        containsCommitish - a commit ID or ref name
        Returns:
        this instance
        Since:
        3.4