Allow basic branch out functionality in packages

This commit is contained in:
Waqar Ahmed
2021-08-14 02:44:00 +05:00
parent 86e09c35f4
commit 21c1bf9da5
5 changed files with 64 additions and 40 deletions

View File

@@ -26,3 +26,7 @@ def retrieve_git_branch(path):
def branch_exists_in_repository(origin, branch):
cp = run(['git', 'ls-remote', origin], log=False)
return bool(re.findall(fr'/{branch}\n', cp.stdout, re.M))
def create_branch(path, base_branch, new_branch):
run(['git', '-C', path, 'checkout', '-b', new_branch, base_branch])