Reputation: 1804
A parent git repo contains several submodules, and the folder structure as belowing:
parent-dir
src
module-a
module-b
module-c
module-spec
In one parent git commit, a submodule may have multi commits.
How to get all file names that changed in module-spec
contains in a parent commit?
Found this question but the answer do not work.
Upvotes: 1
Views: 239
Reputation: 94827
You can also use git ls-tree
to get commits of the submodule registered in the superproject and run git diff
directly in the submodule:
prev_commit=`git ls-tree HEAD~ module-spec | awk '{print $3}'`
curr_commit=`git ls-tree HEAD module-spec | awk '{print $3}'`
cd module-spec
git diff --name-only $prev_commit $curr_commit
Upvotes: 1
Reputation: 94827
Try
git diff --submodule[=diff/log/short] HEAD~ -- module-spec
git diff --submodule
to run diff on submodules. [=diff/log/short]
— choose one of the formats; default is short
.
HEAD~
to run diff between the previous commit of the superproject and the current.
module-spec
to limit the diff only for the submodule. Excludes diff for the very superproject and other submodules.
Upvotes: 0