Archive for März, 2008

You are currently browsing the Martin en Neukoelln archives for März, 2008.


Sake script for git helper

According to my last post about scripting git I thought about how to automate these nasty command line scripts in a way that I can use them anywhere without too much hassle.

Few days ago, I read the first time about sake scripts(shame on me) and I thought why not try – and not really surprisingly it works.

Since I want to share my genius work with you I published the script using a small pastie and you can install them in no time to your local sake script repository.

# For security reasons look at the script
sake -e http://pastie.caboo.se/173143.txt
# install the script
sake -i http://pastie.caboo.se/173143.txt

Git helper

When you try to document you changes in a typical CHANGELOG file, you don’t want to write all the changes since the last release or last few commit there by hand. This should be done easily by some kind of command that will export all your changes to the CHANGELOG file.

There are two easy ways to do this, that will basically do the same. the only difference between them is that one extracts the commit messages directly with the help of git log, while the other lists all changes of the current branch.

Now let’s have a first at the awful complicated solution to get the commit log for your current branch

git show-branch | awk -F"merb_localize.*]( )*" " {print \$2}" > CHANGELOG

To get this working for your project you have to replace merb_localize with your own branch name.

The second solution is a little more sophisticated and better to handle, it is based on git log instead of git show-branch

git log --pretty="format:%s (committer: %cn | auther: %an)"  ... > CHANGELOG

What happens is that it will go through all commit messages and format the commit message using the defined format with the --pretty. The result will look like:

* my message (commiter: Martin | author: Martin)

There are plenty of format options to modify the output written to the CHANGELOG file. You can find the options in the man page for git log.