if you have a lot of subrepos, how do you find the ones that got changed as part of your main project and need to be integrated back to their respective repos?
Hi @keithn,
There is unfortunately no easy way to determine this right now. You can look at #274 for an explanation of some steps that can be performed.
There is an -A option for push but then you will push all your subrepos and that might not be the desired behavior.
Try something like this Bash command:
for subrepo in $(git subrepo status --quiet); do echo "New local commits for subrepo $subrepo:"; git subrepo branch --fetch --force --quiet $subrepo; commit=$(git subrepo status $subrepo | grep Worktree: | awk '{print $3}'); (set -x; git log --oneline FETCH_HEAD..$commit); done
Reformatted here: https://gist.github.com/b772c6806a58a6a54f011cf8a2df427d
@grimmySwe we could add something to status to tell how commits ahead or behind a subrepo branch is.
@ingydotnet But don't you need to fetch and actually perform the subrepo branch to be able to find out the actual status?
@grimmySwe Yes. But I did that. See: https://gist.github.com/anonymous/b772c6806a58a6a54f011cf8a2df427d#file-x-bash-L4
The status command shows a line like thist (if there is a branch):
Worktree: /Users/ingy/src/git-subrepo/.git/tmp/subrepo/ext/test-more-bash 24a6cce [subrepo/ext/test-more-bash]
If we show that line, we can at least say how many commits ahead or behind it it.
Most helpful comment
@grimmySwe Yes. But I did that. See: https://gist.github.com/anonymous/b772c6806a58a6a54f011cf8a2df427d#file-x-bash-L4
The status command shows a line like thist (if there is a branch):
If we show that line, we can at least say how many commits ahead or behind it it.