Friday, February 26, 2010

Git: Recursively check submodules for diffs

Git is pretty good to work with, but when it comes to merging submodules, sometimes the project dies in the ass because someone (ie. me) forgot to commit a submodule.

kermit miffy
An example of the project dying in the ass.

To check for nested differences, use the following command:

git submodule foreach --recursive git diff --name-status

It'll go through each submodule it finds and check for a diff, spitting out the name of the files that have changed.

Entering 'submoduleA'
M       models.py
Entering 'submoduleB'
M       models.py
Entering 'submoduleC'
Entering 'submoduleD'

Remove the "--name-status" flag to show the actual diffs.

No comments:

Post a Comment

Leave your thoughts ...

---
If you are having trouble with copy/pasting in comments, you need to sign in or click 'Preview'.

For more information about this Firefox bug, see here.