File size: 222 Bytes
4450790
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
import git

commit_hash = "a361cc1"

repo = git.Repo('.')

if repo.is_dirty():
    repo.git.stash()

repo.git.update_ref("refs/remotes/origin/main", commit_hash)
repo.remotes.origin.fetch()
repo.git.pull("origin", "main")