gmuhammad
gmuhammad

Reputation: 1438

Find a particular branch when working on multiple submodules

I am working on a project that consists of multiple submodules. Let's say 20 submodules. Now a particular ticket requires some changes in module_3, and module_4, and module_7. So I create a branch for that ticket (say branch_ticket_x) on module_3, and module_4, and module_7, did my changes and commit the code (have not pushed it yet). At that particular moment my Manager came and assigned me another xyz task on another project. Unfortunately that task took long time. And when I came back to my old project I forgot the modules on which I was previously working, but I know that I created the branch with branch_ticket_x name. So is there any way or git command, I can find out on which modules I was working before.

If this is a duplicate question, please give me the link to solution.

Upvotes: 0

Views: 107

Answers (3)

jthill
jthill

Reputation: 60275

git submodule -q foreach '
        git rev-parse -q --verify branch_ticket_x >&- && echo $name || true'

You could also git rev-parse --show-toplevel instead of the echo $name if using the variable doesn't suit.

Upvotes: 3

nitishagar
nitishagar

Reputation: 9403

You might want to try ls-tree:

git ls-tree <commit-SHA>

Upvotes: 0

daiboo
daiboo

Reputation: 1

If the path/filenames are distinct you can

$ git log --name-only branch_ticket_x

That will list the files you touched as part of your commit(s)

Upvotes: 0

Related Questions