Returns the Git reference for the given branch name (local or remote). If branch_type is BranchType.REMOTE, you must include the remote name in the branch name (eg ‘origin/master’).
Return a list with all the branches in the repository.
The flag may be:
BranchType.LOCAL - return all local branches (set by default)
BranchType.REMOTE - return all remote-tracking branches
BranchType.ALL - return local branches and remote-tracking branches
Branches inherit from References, and additionally provide specialized accessors for some unique features.
Example:
>>> # Listing all branches
>>> branches_list = list(repo.branches)
>>> # Local only
>>> local_branches = list(repo.branches.local)
>>> # Remote only
>>> remote_branches = list(repo.branches.remote)
>>> # Get a branch
>>> master_branch = repo.branches['master']
>>> other_branch = repo.branches['does-not-exist'] # Will raise a KeyError
>>> other_branch = repo.branches.get('does-not-exist') # Returns None
>>> remote_branch = repo.branches.remote['upstream/feature']
>>> # Create a local branch, branching from master
>>> new_branch = repo.branches.local.create('new-branch', repo[master_branch.target])
>>> # And delete it
>>> repo.branches.delete('new-branch')
Branch.
The name of the local or remote branch.
Delete this branch. It will no longer be valid!
True if branch is checked out by any repo connected to the current one, False otherwise.
True if HEAD points at the branch, False otherwise.
The name of the local or remote branch (bytes).
Find the remote name of a remote-tracking branch.
This will return the name of the remote whose fetch refspec is matching the given branch. E.g. given a branch ‘refs/remotes/test/master’, it will extract the ‘test’ part. If refspecs from multiple remotes match, the function will raise ValueError.
Move/rename an existing local branch reference. The new branch name will be checked for validity. Returns the new branch.
The branch’s upstream branch or None if this branch does not have an upstream set. Set to None to unset the upstream configuration.
The name of the reference set to be the upstream of this one