Add some useful git functions
This commit is contained in:
parent
1112b1ad49
commit
ee8b49f078
1 changed files with 16 additions and 0 deletions
|
@ -1,5 +1,6 @@
|
|||
import os
|
||||
import subprocess as sub
|
||||
from pathlib import Path
|
||||
from system_repository import SystemRepository
|
||||
from release_type import ReleaseType
|
||||
|
||||
|
@ -33,3 +34,18 @@ class GitRepository():
|
|||
else:
|
||||
return None
|
||||
|
||||
def get_current_branch(self):
|
||||
self.system_repository.run_checked('git', 'branch', '--show-current')
|
||||
|
||||
def add_file(self, file_path: Path):
|
||||
self.system_repository.run_checked('git', 'add', file_path)
|
||||
|
||||
def commit(self, commit_message: str):
|
||||
self.system_repository.run_checked('git', 'commit', '-m', commit_message)
|
||||
|
||||
def push(self):
|
||||
self.system_repository.run_checked('git', 'push')
|
||||
|
||||
def checkout(self, branch: str):
|
||||
self.system_repository.run_checked('git', 'checkout', branch)
|
||||
|
||||
|
|
Loading…
Reference in a new issue