This repository has been archived on 2023-07-17. You can view files and clone it, but cannot push or open issues or pull requests.
pushee/git.py

23 lines
472 B
Python
Raw Normal View History

2019-11-22 15:03:21 +01:00
#!/usr/bin/env python3
from utils import handle_error, run_cmd
def checkout_branch(branch: str) -> None:
if run_cmd("git", "checkout", branch)[0] != 0:
if run_cmd("git", "checkout", "-b", branch)[0] != 0:
exit(1)
def add_files(*files: str) -> None:
run_cmd("git", "add", *files)
def commit(msg: str) -> None:
run_cmd("git", "commit", "-m", msg)
def push(remote: str, branch: str):
run_cmd("git", "push", "-u", remote, branch)