Automatically commit to git after each save
Find a file
Tom Willemse d8d9dab5d2 Add option to prevent new files from being added to git
Setting ‘gac-automatically-add-new-files-p’ to t will tell git-auto-commit-mode
not to try adding new files to the git repository.
2019-12-10 21:39:06 -08:00
tests Add option to prevent new files from being added to git 2019-12-10 21:39:06 -08:00
.gitignore Fix new files not being committed 2019-12-10 21:18:17 -08:00
Cask Fix new files not being committed 2019-12-10 21:18:17 -08:00
CONTRIBUTING Add other complementary files 2013-04-10 01:51:30 +02:00
COPYING Added COPYING file 2012-01-10 21:48:17 +01:00
git-auto-commit-mode.el Add option to prevent new files from being added to git 2019-12-10 21:39:06 -08:00
INSTALL Add other complementary files 2013-04-10 01:51:30 +02:00
NEWS Add option to prevent new files from being added to git 2019-12-10 21:39:06 -08:00
README.org Add option to prevent new files from being added to git 2019-12-10 21:39:06 -08:00

git-auto-commit-mode

NAME

git-auto-commit-mode - Emacs minor mode to automatically commit (and push) a git repository.

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-automatically-add-new-files-p
A boolean value indicating whether or not git-auto-commit-mode should add new (untracked) files to the repository.
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. Note: Since the summary is asked for before the commit, but after the file has been saved, pressing C-g while entering the Summary will stop the commit from being made, but not the file from being saved.
gac-shell-and
A string that can be used to change how the shell combines commands. The default " && " is good for bash-like shells, but " ; and " would be used for fish, for example.
gac-debounce-interval
A number specifying a buffer between automatic commits in seconds. Wait with making an actual commit until this number of seconds elapses.