A
A
Alexey Yarkov2016-08-06 23:03:48
git
Alexey Yarkov, 2016-08-06 23:03:48

How to add a folder from the master branch to gh-pages?

There is npm and bower package. Documentation is generated for it using JSDoc. Docks are saved in the docs folder of the master branch, and of course, the docs folder is specified in .gitignore. I would like, for example, using a bash script to send the docs folder to the gh-pages branch so that the documentation is available online.
I got one gist here , but something is not right ))))
Or maybe there is such a command in git?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Yarkov, 2016-08-06
@yarkov

Thanks everyone, I found this:

#!/bin/sh
branch=$(git rev-parse --abbrev-ref HEAD)
if [ "gh-pages" == "$branch" ]; then
    exit
fi

echo Updating gh-pages for branch $branch

git checkout gh-pages
git checkout $branch -- dist
mkdir -p $branch
git rm --ignore-unmatch -rf $branch
mv -f dist/* $branch
git rm -rf --ignore-unmatch dist
git add $branch
git describe --always | git commit -m -
git checkout $branch

Right now, I'll redo it a bit and hang it on a hook.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question