utils.git

git.py

Common code useful for interacting with git.

Example Usage: from utils import git from utils.git import checkout

 1#!/usr/bin/env python3
 2"""
 3git.py
 4
 5Common code useful for interacting with git.
 6
 7Example Usage:
 8    from utils import git
 9    from utils.git import checkout
10"""
11
12from subprocess_tee import run as _run
13try:
14    import loggy
15except ImportError:
16    from utils import loggy
17
18# try:
19#     from .common import subprocess_long as _long_run
20# except ImportError:
21#     from utils.common import subprocess_long as _long_run
22
23
24def checkout(branch):
25    """
26    git.checkout()
27
28    Check out a specific branch
29
30    branch: String
31    """
32    loggy.info(f"git.checkout(): Checking out {branch}")
33    _run(f"git checkout {branch}", shell=True, check=True)
34    _run(f"git pull origin {branch}", shell=True, check=True)
def checkout(branch)
25def checkout(branch):
26    """
27    git.checkout()
28
29    Check out a specific branch
30
31    branch: String
32    """
33    loggy.info(f"git.checkout(): Checking out {branch}")
34    _run(f"git checkout {branch}", shell=True, check=True)
35    _run(f"git pull origin {branch}", shell=True, check=True)

git.checkout()

Check out a specific branch

branch: String