Skip to content

Instantly share code, notes, and snippets.

@onemach
Created April 14, 2013 12:51
Show Gist options
  • Save onemach/5382603 to your computer and use it in GitHub Desktop.
Save onemach/5382603 to your computer and use it in GitHub Desktop.
My Writing Utility
#!/usr/bin/env python
import sys
import os
def create(name):
file = open(os.environ['HOME'] + "/.onemach/essay_remote")
gitRemote = file.readline().strip()
if not gitRemote:
pass #error
os.system("git clone " + gitRemote + " " + name)
os.chdir(name)
os.system("git checkout -b " + name + " master")
file = open(".writing_branch", "w+")
file.write(name)
def sync(name):
os.chdir(name)
os.system("git commit -am nothing")
file = open(".writing_branch")
branch = file.readline().strip()
os.system("git push origin " + branch)
if __name__ == "__main__":
cmd = sys.argv[1]
if cmd == "create":
create(sys.argv[2])
elif cmd == "sync":
sync(sys.argv[2])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment