Exposition:
- I do not git commit all that often; only after a lot of work.
- I occasionally do stupid things, like ‘rm -f blah.hpp’ when I mean ‘rm -f blah.cpp’
- I use zsh
- I would like to set something up in my zsh precmd to do a “git add **/*; git commit -a -m ‘auto log …'”
Now, here’s the issue:
alot of these commits are spurious. At some future point (like 24 hours later), I would like to kill all these useless intermediate autocommits.
If your solution requires I slightly modify my git workflow — that is okay. I am willing to introduce changes in order to have this autocommit setup.
You want automatic “snapshot-style” commits which squash down once you have a true commit to make.
Here is my rough idea:
masteras your “official” commit timeline and work in a feature branch. (This is a pretty orthodox workflow anyway.)--squashand commit with an appropriate message.This might require some aliases both in zsh and git but I think it could work. Here are some rough ideas, the key one being git merge –squash. (Also, sorry, I only speak Bash.)
Keep in mind there will be tons of edge cases such as files you should have added to .gitignore and I am sure plenty of others. But I think it could work.