I'm new to Git and I'm trying to get all the paths of the submodules present.
Right now, when I execute the command git submodule status
, I get the following output:
e1591f7ea63bcaaa7bee0b78b5dcf7754ea00410 main/abc (heads/master)
f61c2cd18e25228b681d516236b15eacc72363b6 xyz (heads/master)
Is there a way to get the output as a string like this:
main/abc
xyz
I tried to find an answer in the official documentation of Git, but failed to do so.
So I used sed to filter out the content what I need.
git submodule status | sed -n -e "s,^[-+\ ][^\ ]*\ \([^\ ]*\),\1,p"