074739d78f
This patch prevents frequent saves from making an excessively large number of commits. With gac-debounce-interval (a buffer-specific variable) set to a number representing seconds, buffers with git-auto-commit-mode active will only make Git commits at the end of the given interval after a save. So with gac-debounce-interval set to 300, a buffer will commit changes accumulated over 5 minutes, rather than at every save. It will also commit if the buffer is killed. This mode of operation can be made default with, e.g.: (setq-default gac-debounce-interval 300) |
||
---|---|---|
.gitignore | ||
CONTRIBUTING | ||
COPYING | ||
git-auto-commit-mode.el | ||
INSTALL | ||
NEWS | ||
README.org |
git-auto-commit-mode
SYNOPSIS
M-x git-auto-commit-mode <RET>
DESCRIPTION
git-auto-commit-mode is an Emacs minor mode that tries to commit changes to a file after every save.
The commit message sent to git is always the filename of the file saved, relative to the root of the git repository.
USAGE
When enabled, git-auto-commit-mode uses the after-save-hook
to
commit changes to git each time. If gac-automatically-push-p
is
non-nil it also tries to push the HEAD
to the current upstream.
Making sure that upstream is properly set is the responsibility of
the user.
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:
;; -*- eval: (git-auto-commit-mode 1) -*-
If you're using an older version of Emacs, that should be:
;; -*- mode: git-auto-commit -*-
As a directory-local variable
If you're using Emacs 24 or newer you should set an eval
variable:
((nil . ((eval git-auto-commit-mode 1))))
If you're using an older version of Emacs, that should be:
((nil . ((mode . git-auto-commit))))
As a hook
To enable git-auto-commit-mode each time a certain-hook
runs:
(add-hook 'certain-hook 'git-auto-commit-mode)
CUSTOMIZATION
git-auto-commit-mode is a simple mode, as such it offers little customization.
-
gac-automatically-push-p
- A boolean value indicating whether or
not git-auto-commit-mode should try to push the git
repository's
HEAD
to its default upstream. Setting up the upstream is the user's responsibility. - gac-ask-for-summary-p
- A boolean value indicating whether or not git-auto-commit-mode should ask the user for a commit message every time a commit is made.