
-----------------------------------
Zren
Mon Jul 11, 2011 7:17 pm

Git on Windows Scripts [Python+AHK]
-----------------------------------
Pushing stuff to git is fairly annoying. At least for me. Compared to Ctrl+s, it's painful. Most of the time I don't even have the git shell open, or I have to use the cd to locate the file. Leaving the shell open is fine, but break workflow as you have to change windows.

Anyways, I checked out the link that opened the shell, and found out an argument for sh.exe that'll execute code. From there, I moved it to a python script. It probably could all go in gitUpdate.py
/d/ = D:\ drive for those wondering.

#!/usr/bin/env python
import os
p_cmd = 'C:\\Windows\\SysWOW64\\cmd.exe'
p_sh = 'C:\\Program Files (x86)\\Git\\bin\\sh.exe'
p_project = '/d/Code/Python/pyTactics/'
project_remote = 'origin'
project_repo = 'master'
msg = raw_input("Update msg: ")
args = '''/c ""%s" --login -i -c "cd %s;git init;git add *;git commit -m '%s';git push %s %s;""''' % (p_sh, p_project, msg, project_remote, project_repo)
os.execv(p_cmd, list(args.split(" ")))


AutoHotKey Script (gitBind.ahk)
I bind the CapsLock key as it's easily the most useless key ever. It's also big.
[code]
Capslock::Run open "D:\Code\Python\gitUpdate.py"
[/code]

Basically your workflow is now:

*New window takes focus*
Enter update message

*Window disappears*
Back to coding.
