git: list of all changed files including those in submodules

前端 未结 6 1709
死守一世寂寞
死守一世寂寞 2020-12-08 02:53

I would like to get a list of all files, which have changed betweet two commits including those in submodules.

I know I can do this:

git diff --name-         


        
6条回答
  •  抹茶落季
    2020-12-08 03:07

    So, the very straightforward script that lists all changes compared to a revision

    #!/bin/sh
    echo "Listing changes for super module"
    git diff $1 --name-only
    subs=(`git submodule | awk '{print $2}'`)
    for sub in ${subs[*]}; do
       lastrevision=`git diff  $1 $sub | fgrep "Subproject" | head -n1 | awk '{print $3}'`
       cd $sub
       echo "Listing changes for $sub"
       git diff $lastrevision --name-only
       cd ..
    done
    

    it takes one argument - revision you want to compare with. Make sure that there is fgrep "Subproject", not fgrep "Submodule".

提交回复
热议问题