Skip to content

Instantly share code, notes, and snippets.

@amandeepjutla
Last active August 29, 2015 14:19
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 amandeepjutla/8d483f30d680e6cc68be to your computer and use it in GitHub Desktop.
Save amandeepjutla/8d483f30d680e6cc68be to your computer and use it in GitHub Desktop.
Automated way to do basic things in an indelicate way. Useful if your needs are limited and you are the only person using a repository; probably worse than useless otherwise.
#!/usr/bin/env python
# raleigh: a stupid git wrapper
import subprocess, sys
try:
if sys.argv[1].lower() == "local":
name = raw_input("Name of commit: ")
subprocess.call("git add .", shell=True)
subprocess.call("git commit -m " + "'" + name + "'", shell=True)
if sys.argv[1].lower() == "revert":
subprocess.call("git add . && git reset --hard HEAD", shell=True)
if sys.argv[1].lower() == "undo":
subprocess.call("git reset --hard HEAD^", shell=True)
subprocess.call("git push origin --force", shell=True)
if sys.argv[1].lower() == "history":
subprocess.call("git log -p", shell=True)
if sys.argv[1].lower() == "help":
print "\tno argument \tcommits changes, pushes remotely"
print "\tlocal \t\tcommits changes only"
print "\trevert \t\treverts to last commit"
print "\tundo \t\tundoes last commit locally and remotely"
print "\thistory \tshows patch history"
except:
name = raw_input("Name of commit: ")
subprocess.call("git add .", shell=True)
subprocess.call("git commit -m " + "'" + name + "'", shell=True)
subprocess.call("git push origin master", shell=True)
print "Done."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment