githubteacher / githubteacher/essentials-aug

Script for updating Submodules

Open
#49 1 comment 1 reaction 0 assignees View on GitHub
Dominant language
C++
Stars
1
Forks
3
PR merge metrics
No merged PRs in 30d

Description

@diarmaidm First, I should say you can really go nuts with these scripts so be sure to check out this article for even more scripting goodness: https://medium.com/@porteneuve/mastering-git-submodules-34c65e940407#.6el38r8bc

Here is the bash script we use to update our submodules - keep in mind that the submodule was already added with `git submodule add ` and we are generating a static copy of the site based on the submodule so depending on your use case you may only need 1/2 of this:

```
#!/bin/sh

echo "==> Update submodules..."
git submodule update --recursive

echo "==> Build the on-demand..."
pushd on-demand-source
# Clean up any existing generated artifacts
rm -rf _site/
# Merge in any master-published changes from the on-demand submodule
git pull origin master:master
# Run a regular build on the kit so we can harvest the output
script/build
popd

echo "==> Copy on-demand module into services-web..."
# Clean up existing kit. Always start fresh.
rm -rf on-demand/
# Copy all the kit from the generated site to the kit static-resources folder
cp -r on-demand-source/_site on-demand

echo "==> Staging updated course for commit..."
# Add submodule, in case it had new commits
git add on-demand-source
# Add the generated and copied static kit
git add -A on-demand

echo "NOTE: Review updated on-demand training, and if satisfied, commit and push."
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.