Saturday, February 27, 2010

(provide 'git-addendum)

So the git addons I wanted to write are finished and working perfectly. They're really simple, but they completely annihilate my need to go to terminal during my daily hacking.

  ;;Addendum to the built-in GIT library for Emacs
  (defun git-init (directory)
  "Initializes the given directory as a GIT repo, then runs git-status on it"
  (interactive "DSelect directory: ")
  (cd directory)
  (shell-command "git init ")
  (git-status directory))

  ;;added (define-key map "\C-p" 'git-pull) to git-status-mode-map in git.el
  (defun git-pull (remote-dir)
  "Pulls from a directory. Typical input is 'user@remote-machine:directory maste'"
  (interactive "sSelect remote dir and branch: ")
  (unless git-status (error "Not in git-status mode"))
  (shell-command (concat "git pull " remote-dir))

  (provide 'git-addendum)

I'm actually highly surprised that git.el doesn't just come with these, as they seem obvious and easy. I sent it over to 'gitster at pobox dot com', which is the listed email of its maintainer. Not sure whether it'll come to anything, but in the meanwhile, at least I get to use it.

No comments:

Post a Comment