Tuesday, June 19, 2012

git submodules and branches

normally git submodules are working in a 'detached mode'. This means that if you want to commit some changes, they could be lost (or at least you need to recover it) if you didn't create a branch for it.

But git submodules can also handle automerging/-rebasing on every git submodule update call.

This could be done by setting the correct commandline switch:
$ git submodule update --merge  # for merging 
$ git submodule update --rebase # for rebasing
or you could set it in your git config by issuing
$ git config submodule.[the submodule name].update merge # for merging
$ git config submodule.[the submodule name].update rebase # for rebasing
or doing it all in once
$ for submodule in $(git submodule | cut -d' ' -f1); do git config submodule.${submodule}.update merge; done; # for merging
$ for submodule in $(git submodule | cut -d' ' -f1); do git config submodule.${submodule}.update rebase; done; # for rebasing



BlueC0re

Friday, May 4, 2012

git pre-receive hook with checkstyle for java code checking

Today I have written a small python script for forcing the sun coding conventions in a small project. For checking the java source code I have used the checkstyle tool.

The following python script uses the git executable for creating a file list of all changed files, latest file revision only, and run checkstyle over it.