Skip to content

Instantly share code, notes, and snippets.

@tacitphoenix
Created August 8, 2020 10:45
Show Gist options
  • Save tacitphoenix/ee4a48e51c7ba6d5a5d91783c9568b0d to your computer and use it in GitHub Desktop.
Save tacitphoenix/ee4a48e51c7ba6d5a5d91783c9568b0d to your computer and use it in GitHub Desktop.
A script to add example repos to a companion practice repo
#!/bin/bash
BOOK_REPO=<git url to example repo>
EXCODE=temp/example_code
# make top-level temp directory
mkdir -p ../$EXCODE
# add top-level temp directory to gitignore
if ! grep -q $EXCODE ../.gitignore; then
echo "${EXCODE}/" >> ../.gitignore
fi
# clone book example repo to temp directory
git clone $BOOK_REPO ../$EXCODE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment