help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: git/mercurial checkin(commit) with every save


From: Uwe Brauer
Subject: Re: git/mercurial checkin(commit) with every save
Date: Sun, 04 Dec 2022 22:52:23 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

>>> "JWH" == John W Higgins <wishdev@gmail.com> writes:

> Good Day,
> On Sun, Dec 4, 2022 at 10:21 AM Uwe Brauer <oub@mat.ucm.es> wrote:

>> 
>> It is possible for RCS to have a checkin with every save.
>> 
>> HG/Git are a bit different since they require a commit message for each
>> commit.
>> 
>> Does anybody know about a similar feature for these two VCs?
>> 
>> 
> Git - https://github.com/ryuslash/git-auto-commit-mode

> Used it for years - works like a charm


This primitive solution is for the moment enough for me

(defun my-hg-checkin-on-save ()
  "This is a trivial command for commiting on every save!"
  (interactive)
  (shell-command "hg ci -m \"Automatic commit on file save \" "))   

(define-minor-mode hg-auto-commit-mode
  "Automatically commit any changes made when saving with this mode turned on."
  :lighter " AHG"
  (if hg-auto-commit-mode
      (add-hook 'after-save-hook 'my-hg-checkin-on-save t t)
    (remove-hook 'after-save-hook 'my-hg-checkin-on-save t)))

And then at the end of the day I rebase all this commits to a single one.

Of course, if I added files etc, I need a more sophisticated solution.




-- 
Warning: Content may be disturbing to some audiences
I strongly condemn Putin's war of aggression against the Ukraine.
I support to deliver weapons to Ukraine's military. 
I support the ban of Russia from SWIFT.
I support the EU membership of the Ukraine. 
https://addons.thunderbird.net/en-US/thunderbird/addon/gmail-conversation-view/

Attachment: smime.p7s
Description: S/MIME cryptographic signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]