St my new job I have been exposed to Git version control. I had always used SVN, but never really used any of the advanced features like branching or tagging. I now like git. It has taken a little trial and error and some reading http://progit.org/book/
This post is about automating commits so I don't have to worry about it and I get an automatic "go back in time" versioning system.
Reference: http://www.spheredev.org/wiki/Git_for_the_lazy Excerpt:
Work in bits
When dealing with git, it's best to work in small bits. Rule of thumb: if you can't summarise it in a sentence, you've gone too long without committing.
Well I wanted to have the bits part, but not having to add a message every time. I usually code for a single specific purpose at any given time. But in the process of "getting there" there are many changes that happen and that I may want to go back to in the evolution. So here is what I did: I made the following cron job:
#!/bin/bash
pushd ROOTPATHOFREPOSITORY
/FULLPATH/git commit -a -m "auto commit"
The key part here is the pushd command. It was a pain figuring that one out. executing from cron makes git not "know" where it is so I kept getting "fatal: Not a git repository (or any of the parent directories): .git" errors
Hopefully this little pushd command is useful to someone else.