-
Notifications
You must be signed in to change notification settings - Fork 8
Home
cdmgtri edited this page Feb 10, 2021
·
1 revision
In addition to the standard specification build steps, set up a git pre-commit hook to automatically copy the latest build into the /docs/draft
directory before a commit is made on the dev branch. Pre-commit hooks are local, so each specification editor should set this up in their cloned repo.
- Go to
.git/hooks/pre-commit.sample
and remove the.sample
extension - Replace the contents of the
pre-commit
with the code below.
It checks to determine if the user is on thedev
branch, and if so, it copies build files to/docs/draft
and adds it to the current commit operation in progress.
#!/bin/sh
BRANCH=`git rev-parse --abbrev-ref HEAD`
if [[ "$BRANCH" == "dev" ]]; then
cp niem-code-lists* docs/draft/
cp code-lists* docs/draft/
cp -r example docs/draft/
git add docs/draft
echo "[Git pre-commit hook for branch 'dev']: Copied files to /docs/draft for GitHub Pages."
fi