Reputation: 419
Question: Is there a simple way to automatically extract the commit messages from a subrepo/submodule in git and create a commit message from these in the repo that contains the subrepo. I understand there is a way through some command line magic, the question is if there is some git functionality to do this.
Context:
I am working on a project that uses git subrepos.
Project A
is the main project. In the folder structure of Project A
, there is another project, Project B
. Project B
is itself a git repo, that is used as a subrepo (or submodule) in Project A
. I work in Project B
, and it falls on me to bump (update) the subrepo in Project A
.
I do this through
cd /ProjectA/ProjectB
git pull
cd ../
git add .
git commit -m "Update Project B: <List of all changes since latest bump>"
git push
If there have been many commits since the latest bump, Writing <List of all changes since latest bump>
becomes very tedious.
I wonder if there is a way to automatically extract the commit messages from Project B
and create a commit message from these.
The dream solution would be to just have to write git commit --extractMessageFromSubrepo
or something similar. I understand there is a way through some command line magic, the question is if there is some git functionality to do this.
Upvotes: 1
Views: 122
Reputation: 94502
git diff --submodule
+ git commit
:
git diff --submodule | git commit -F-
-F-
means "read from file -
" and the file -
means the standard input, the pipe in this case.
Upvotes: 2