ryuslash / git-auto-commit-mode

Automatically commit to git after each save
http://projects.ryuslash.org/git-auto-commit-mode/
GNU General Public License v3.0
167 stars 26 forks source link

+TITLE: git-auto-commit-mode

+STARTUP: showall

** Enabling

Since git-auto-commit-mode is a regular minor mode you have more than one option to enable it.

*** As a file-local variable

If you're using Emacs 24 or newer you should set an =eval=
file-local variable:
#+BEGIN_EXAMPLE
  ;; -*- eval: (git-auto-commit-mode 1) -*-
#+END_EXAMPLE

If you're using an older version of Emacs, that should be:
#+BEGIN_EXAMPLE
  ;; -*- mode: git-auto-commit -*-
#+END_EXAMPLE

*** As a directory-local variable

Create a ~.dir-locals.el~ file in the directory where you want
git-auto-commit-mode to be enabled. This will also apply to any
subdirectories, so be careful. For more information see the [[https://www.gnu.org/software/emacs/manual/html_node/emacs/Directory-Variables.html#Directory-Variables][Per-Directory
Local Variables]] section in the Emacs manual. Then put one of the following
snippets of code in there:

If you're using Emacs 24 or newer you should set an =eval= variable:
#+BEGIN_EXAMPLE
  ((nil . ((eval git-auto-commit-mode 1))))
#+END_EXAMPLE

If you're using an older version of Emacs, that should be:
#+BEGIN_EXAMPLE
  ((nil . ((mode . git-auto-commit))))
#+END_EXAMPLE

*** As a hook

To enable git-auto-commit-mode each time a ~certain-hook~ runs:
#+BEGIN_EXAMPLE
  (add-hook 'certain-hook 'git-auto-commit-mode)
#+END_EXAMPLE