Xen schreef op 23-05-2017 18:43:
Git modules.

I wanted to use git submodules to group repositories together, seemed
easy enough.

But now I learn that every commit in the sub-repository must also be
met by a commit in the parent repository, which makes it a bit
annoying to do anything.

Is it possible to someone not let the parent repository care, or for
it to always point to the master branch (head) of the sub-repository?

So I created a script at https://gist.github.com/drydenp/83116f5149a20a4ea25b7e5c98dd883a

that can be run from a cron job if supplied the directory of a git repository, the only caveat is it has to have an "origin" defined because I use it to get the name ;-).

The script will not care about branches but it is meant for a "housing" repository that only houses other repositories.

So generally you would only add submodules to such a thing and other stuff you haven't submoduled yet.

The script is meant to be run every hour. It checks whether there are any submodules that have new commits not registered in the parent. Then it adds individual commits for each of those repositories and does not yet push anything.

If the index is changed for the parent repository with staged changes then the script will bolt and not do anything.

It will send you an email about it though.

If the index is clean and there are changes to the sub-modules it will create commits and send you an email about it.

If commits fail for some reason I cannot yet imagine it will send an error email.

All other errors are sent by cron as it would produce output on >&2.

Now all I need to do is for it to push automatically and for the email message to have a bit more information :p.

Then I can just run this thing every hour automatically and never have to worry about the parent repository running "behind" the child repositories.

--
You received this message because you are subscribed to the Google Groups "Git for 
human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to