git-auto-commit-mode - Emacs minor mode to automatically commit (and push) a git repository.
M-x git-auto-commit-mode <RET>
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.
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.
Since git-auto-commit-mode is a regular minor mode you have more than one option to enable it.
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
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 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:
((nil . ((eval git-auto-commit-mode 1))))
If you’re using an older version of Emacs, that should be:
((nil . ((mode . git-auto-commit))))
To enable git-auto-commit-mode each time a certain-hook
runs:
(add-hook 'certain-hook 'git-auto-commit-mode)
git-auto-commit-mode is a simple mode, as such it offers little customization.
gac-automatically-push-p
HEAD
to its default upstream. Setting up the upstream is the user’s responsibility.
gac-automatically-add-new-files-p
gac-ask-for-summary-p
C-g
while entering the Summary will stop the commit from being made, but not the file from being saved.
gac-shell-and
gac-debounce-interval
gac-add-additional-flag
git add
command.
gac-commit-additional-flag
git commit
command.
gac-silent-message-p
nil
, meaning that the summary would be displayed on every commit.
To set any of these options, you can:
M-x customize-group git-auto-commit-mode
).(setq-default gac-ask-for-summary-p t)
(defun set-my-settings () (setq gac-automatically-push-p t)) (add-hook 'org-mode-hook 'set-my-settings)
.dir-locals.el
(see Per-Directory Local Variables):
((nil . ((gac-shell-and . " ; and "))))
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4