linuxinstaller/libreticmenu/GitActions.py

21 lines
419 B
Python
Raw Normal View History

2024-10-06 23:44:04 +02:00
from git import Repo
import os
def getBranch():
repo = Repo(os.getcwd())
branch = repo.active_branch
return branch.name
def setBranch(branch):
repo = Repo(os.getcwd())
git = repo.git
git.switch(branch)
def getBranchList():
repo = Repo(os.getcwd())
remote_refs = repo.remote().refs
refs = list(ref.remote_head for ref in remote_refs if ref.remote_head != 'HEAD')
return refs