def get_current_branch ( ) : cmd = [ "git" , "rev-parse" , "--abbrev-ref" , "HEAD" ] output = subprocess . check_output ( cmd , stderr = subprocess . STDOUT ) return output . strip ( ) . decode ( "utf-8" )
python get current git commit
Return the current branch
def get_current_branch():
    """
    Return the current branch
    """
    cmd = ["git", "rev-parse", "--abbrev-ref", "HEAD"]
    output = subprocess.check_output(cmd, stderr=subprocess.STDOUT)
    return output.strip().decode("utf-8")