Last active
June 7, 2021 15:23
-
-
Save vonHartz/2e21ffa4db8bf2089eea5d30e06989bb to your computer and use it in GitHub Desktop.
Push git ignored folder to subtree branch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# based on https://stackoverflow.com/a/40178818/11051330 | |
STATUS="$(LC_ALL=C git status)" | |
DOCSDIR="docs/_build/" | |
if [[ $STATUS == *"nothing to commit, working tree clean"* ]] | |
then | |
awk -vLine="$DOCSDIR" '!index($0,Line)' ./.gitignore | |
git add . | |
git commit -m "Edit .gitignore to publish docs" | |
git subtree push --prefix $DOCSDIR/html/ origin gh-pages | |
git reset HEAD~ | |
git checkout .gitignore | |
else | |
echo "Need clean working directory to publish" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment