Is there a robust way to do a recursive depth-first git submodule foreach
command? I am using the foreach --recursive
command which does the job, except it is breadth-first. This is a problem because if I have the following structure:
And I have commits in all three, a foreach --recursive add -A && git commit ...
will hit A, B, C, which is problematic if I want the supermodule to capture the commits of B at that time.
I found this discussion from 2008, but it does not look like any of the suggested features are in the current version of Git that I have (1.7.9.5).
I wrote a small bash function to do this (excuse the shorthand naming):
function git-sfed() { git submodule foreach "git submodule foreach '$*' && $*"; }
And testing it with the following fanciful command seems to work:
git-sfed 'python -c "import sys; print sys.argv" $path'
Does this command seem robust, or are there other common existing methods?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…