Skip to content

Instantly share code, notes, and snippets.

@dimpu
Last active December 21, 2017 05:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dimpu/a48c7890a593cdc433cdbd2f4eb3999c to your computer and use it in GitHub Desktop.
Save dimpu/a48c7890a593cdc433cdbd2f4eb3999c to your computer and use it in GitHub Desktop.
Corn git-hub push
# This scrips require schedule,gitpython
# pip3 install schedule
# pip3 install gitpython
import string
import random
import datetime
import schedule # this is for shedule
import time
from git import Repo, Commit
def main():
# file name
file_path = 'commit_list.txt'
# write current timedate to file
f = open(file_path, "a+")
for i in range(2):
f.write("%s\r\n" %
(datetime.datetime.now().strftime("%I:%M%p on %B %d, %Y")))
# All repo operations
path = "."
repo = Repo(path)
origin = repo.remotes.origin
# origin = repo.create_remote('origin', repo.remotes.origin.url)
repo.index.add([file_path]) # add it to the index
# Commit the changes to deviate masters history
repo.index.commit("Added a new file in the past - for later merege")
for commit in repo.iter_commits():
print("Author: ", commit.author)
print("Summary: ", commit.summary)
origin.push()
def job():
main()
print("Git Pusheded...")
# uncommit any
# schedule.every(1).minutes.do(job)
# schedule.every().hour.do(job)
# schedule.every().day.at("10:30").do(job)
schedule.every(20).to(50).minutes.do(job)
# schedule.every().monday.do(job)
# schedule.every().wednesday.at("13:15").do(job)
while True:
schedule.run_pending()
time.sleep(1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment