Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Sep 8th, 2011  |  syntax: None  |  size: 0.99 KB  |  views: 1,072  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
This paste has a previous version, view the difference. Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. .gitconfig
  2.  
  3. [github]
  4. user = your-username
  5. password = your-password
  6.  
  7. [alias]
  8. # git pullrequest branch-name "title line" "description blah blah"
  9.  
  10. pullrequest = !sh -c 'curl -s -u "`git config --get github.user`:`git config --get github.password`" https://api.github.com/repos/`git remote show -n origin | head -n 2 | grep -o github.com[^.]* | cut -b 12-`/pulls -d "\\{\\\"title\\\":\\\"$2\\\",\\\"body\\\":\\\"$3\\\",\\\"head\\\":\\\"$1\\\",\\\"base\\\":\\\"master\\\"\\}"' -
  11.  
  12.  
  13. ----
  14. breaking it down:
  15.  
  16. sh -c '' -  
  17.   run a shell, reading parameters passed in
  18.  
  19. git config --get github.x
  20.   get git config variable
  21.  
  22. git remote show -n origin | head -n 2 | grep -o github.com[^.]* | cut -b 12-
  23.   a very hacky way to get the api path for the repository
  24.   surely there is a better way?
  25.  
  26. "\\{\\\"title\\\":\\\"$2\\\",\\\"body\\\":\\\"$3\\\",\\\"head\\\":\\\"$1\\\",\\\"base\\\":\\\"master\\\"\\}"
  27.  
  28.   the json string. i can't think of any way to make the leaning toothpicks (via @vhata) dissappear?