git_interface.branch
Methods for using the ‘branch’ command
- async git_interface.branch.copy_branch(git_repo, branch_name, new_branch)
Copy an existing branch to a new branch in repo (uses –force)
- param git_repo:
Path to the repo
- param branch_name:
Branch name
- param new_branch:
The new branch name
- raises NoBranchesException:
Branch does not exist
- raises GitException:
Error to do with git
- Parameters:
git_repo (Path | str)
branch_name (str)
new_branch (str)
- async git_interface.branch.count_branches(git_repo)
Count how many branches are in repo, returned value will be at >=0
- param git_repo:
Path to the repo
- raises GitException:
Error to do with git
- return:
Number of branches found
- Parameters:
git_repo (Path)
- Return type:
int
- async git_interface.branch.delete_branch(git_repo, branch_name)
Delete an existing branch (uses –force)
- param git_repo:
Path to the repo
- param branch_name:
Branch name
- raises NoBranchesException:
Branch does not exist
- raises GitException:
Error to do with git
- Parameters:
git_repo (Path | str)
branch_name (str)
- async git_interface.branch.get_branches(git_repo)
Get the head branch and all others
- param git_repo:
Path to the repo
- raises GitException:
Error to do with git
- raises NoBranchesException:
Repo has no branches
- return:
the head branch and other branches
- Parameters:
git_repo (Path | str)
- Return type:
tuple[str, tuple[str]]
- async git_interface.branch.new_branch(git_repo, branch_name)
Create a new branch in repo
- param git_repo:
Path to the repo
- param branch_name:
Branch name
- raises AlreadyExistsException:
Branch already exists
- raises GitException:
Error to do with git
- Parameters:
git_repo (Path | str)
branch_name (str)
- async git_interface.branch.rename_branch(git_repo, branch_name, new_branch)
Rename an existing branch (uses –force)
- param git_repo:
Path to the repo
- param branch_name:
Branch name
- param new_branch:
The new branch name
- raises NoBranchesException:
Branch does not exist
- raises GitException:
Error to do with git
- Parameters:
git_repo (Path | str)
branch_name (str)
new_branch (str)