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
2020-06-08 17:39:36 +02:00

23 lines
491 B
Python

#!/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:
for f in files:
run_cmd("git", "add", f)
def commit(msg: str) -> None:
run_cmd("git", "commit", "-m", msg)
def push(remote: str, branch: str):
run_cmd("git", "push", "-u", remote, branch)