If you go down this “autocommit” road, always be sure to keep such history local. As Russell Steen commented, automatic checkpoints are not something that belongs in any kind of published, advertised branch. It is fine to keep for local reference, but otherwise it is just an ungroomed mess unfit for publication.
It is not too hard to write a simple script that will ‘autocommit’ to an specified branch. The linked script is not one that I use, just one that I found. It is a bit ugly in that it forcibly changes branches, so you would have to make sure it does not run if you are doing stuff manually. Also, it uses ‘porcelain’ Git commands instead of sticking to the lower-level (but correspondingly, more interface-stable) ‘plumbing’ commands.
You might also be interested enough to review a recent thread on the Git mailing list that covered some of this ground.
In particular, it references another script that does not “steal the current branch” and does a better job of using plumbing commands (but inexplicably, still uses git add
instead of git ls-files
and git update-index
).
All in all, writing a script to do what you want is not terribly difficult. Doing it right (using plumbing, not stomping on the active branch (which is easy when you using plumbing), etc.) is a bit more effort, but worth it for the bits of Git that you will learn along the way.
You could even use the old shell implementation of git-commit
as a starting point (and a good example of the plumbing and how to use it).
To get a checkpoint on a regular basis, just a stick script like ones of these it in a crontab.