Since gitmodules were introduced in Git, I like to add them like so:
[submodule \"actionbarsherlock\"]
path = actionbarsherlock
url = git://github.com/JakeWh
Today I found out that can use git config to change the .gitmodules file, and therefore can add the ignore dirty flag without going into the file and adding the line by hand:
git config -f .gitmodules submodule.actionbarsherlock.ignore dirty
In my case, I was able to automate the two steps in a script with that command.