diff options
| -rw-r--r-- | reposync.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/reposync.py b/reposync.py new file mode 100644 index 0000000..c78e8ea --- /dev/null +++ b/reposync.py @@ -0,0 +1,17 @@ +from git import Repo +from datetime import datetime + +repo = Repo("./") +if not repo.bare: + now = datetime.now().strftime("[%H:%M:%S] ") + branch = repo.active_branch + + # Thanks to https://stackoverflow.com/a/65535263/12036073 + if list(repo.iter_commits(f'{branch}..{branch}@{{u}}')): + print(now + "Remote changes detected, pulling...") + # logic + else: + print(now + "Up to date") + +else: + print("Error") |
