Initial commit
This commit is contained in:
commit
59c97f2ada
1 changed files with 13 additions and 0 deletions
13
git-auto-commit-mode.el
Normal file
13
git-auto-commit-mode.el
Normal file
|
@ -0,0 +1,13 @@
|
|||
(defun git-auto-commit ()
|
||||
"Commit `buffer-file-name` to git"
|
||||
(let ((filename (buffer-file-name)))
|
||||
(shell-command (concat "git add " filename
|
||||
" && git commit -m '" filename "'"))))
|
||||
|
||||
(define-minor-mode git-auto-commit-mode
|
||||
"Automatically commit any changes made when saving with this mode
|
||||
turned on"
|
||||
:lighter "ga"
|
||||
(if git-auto-commit-mode
|
||||
(add-hook 'after-save-hook 'git-auto-commit t t)
|
||||
(remove-hook 'after-save-hook 'git-auto-commit t)))
|
Loading…
Reference in a new issue