git-auto-commit-mode
git-auto-commit-mode copied to clipboard
feature: select what will be committed
I see the following options here:
- commit only single file
(setq git-auto-commit-mode-context 'file)
- commit all (staged and/or unstaged) commits in subtree (subdirectory)
(setq git-auto-commit-mode-context 'subtree)
- commit all (staged and/or unstaged) commits in repo
(setq git-auto-commit-mode-context 'repository)
- commit all (staged and/or unstaged) changes to file and its "companion files", e.g.
gtd.org
would add(setq git-auto-commit-mode-context '("gtd.archive.org" "inbox.org")
And then also (setq git-auto-commit-mode-staged-only t)
Hey! Thanks for these suggestions! Does this mean the current situation isn't to your liking? If git-auto-commit-mode
is enabled for all files in a repository every time you make a change you would get a new commit, so I'm not sure which files would be left to commit with it.
Can you elaborate on your situation perhaps?
So, I took some notes in the last weeks. I notice the following use-cases/problems relating to single file commits:
- I have two org-mode files. I move a headline from
a.org
tob.org
, and save all org-mode buffers. Now I have two commits, one which removes the headline ina.org
and one that adds it tob.org
, which feels a lot like inconsistent history/information lost. On code this would be a broken commit. - I add a headline in
a.org
, which creates an entry in.org-id-locations
. I savea.org
, but onlya.org
is committed, not.org-id-locations
. - I add a picture to the directory and link to it in
a.org
. I save the file,a.org
is commited, but I have to manually add the picture file and commit, leaving me with a half-broken commit.
So, there are two problems:
- how do we handle other files (indexed/not indexed) in the same working copy?
- we don't actually want to commit on save, give the operation a chance to finish and/or wait for a slight idle time. (optional, ofc)
Thank you, that helps a lot! Those are excellent points. For the first problem you mention I don't think there is currently anything that can help this, I'll have a look at implementing this when I have some time.
For the second problem you mention, I think this is what gac-debounce-interval
should help with. You should be able to set this to the number of seconds that you want to wait before committing. But I think this only works for individual files at the moment.