Created
June 2, 2015 10:04
-
-
Save judofyr/9e3b48bd045bc60ba1ed to your computer and use it in GitHub Desktop.
This file contains hidden or 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
set -e | |
DIR="docs" | |
BRANCH="gh-pages" | |
# Stage all files in the directory | |
find "$DIR" -type f | xargs git update-index --add | |
# Write the sub-tree | |
TREE=$(git write-tree --prefix="$DIR") | |
# Commit the tree | |
COMMIT=$(git commit-tree "$TREE" -m 'update docs' -p "$BRANCH") | |
# Update branch to the new commit | |
git branch -f "$BRANCH" "$COMMIT" | |
# Unstage files again | |
find "$DIR" -type f | xargs git update-index --remove | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment