Some of the reasons I really like git, all experienced in this week:
Prepare CHANGES file
git log --no-merges --pretty=format:' - %s (%an)' `git tag | tail -n 1`.. to get a nicely formatted list of changes (and who checked it in) since the last tag. OK, most other VCS can also do similar, but git let's me alias this in my
Revert a repo to a few hours earlier
A colleague complains that the test suite for one modul is broken, and he
can't fix it. I check out his head, and can't find the problem after a few
minutes. But I experience strange behaviour during tests (if you run a single
test, it works, if you run all tests, it fails). So, we assume it has to with
the tests fu̸cking up the DB. To prove that his changes caused the problem, I do
git co a_ref_befor_his_commit and magically travel back in time.
The tests work now. So we do
git co HEAD to travel back into the
present, and after some cross-history-diffing, we find the bug & fix it.
No need to set up a server
I was fuzzing with our post-receive hooks, which run after somebody pushed something into the public repo. Our hooks do obvious things like sending out commit mail and IRC notifications, but also nice stuff like building a tarball and uploading it to our custom cpan when the commit was a tag. Only this wasn't working after we switched to another notify-script.
But because git doesn't care where you clone from, and what exactly is a public repo, it was easy to set up a local repo on my disk, clone from it, declare another repo on my disk to be the "remote" and thus test all of the scripts without a) network, b) spamming my colleagues and (most importanly) c) any complicated setup. All that was needed were some dirs on my laptop.
And that's it for todays git propaganda!