Question

My git repo's master branch structure is as follows

/demo
    index.html
    style.css
    reset.css
jquery.dimlights.js
jquery.dimlights.css
jquery.dimlights.min.js
jquery.dimlights.min.css
readme.md

However in the gh-pages branch I just want the contents of /demo without the directory itself. Is there any way to do this?

Was it helpful?

Solution

This is one way:

git checkout -b gh-pages
git rm (everything except demo)
git mv demo/* .
git commit -m "adding content to gh-pages"

Another way depending on how you want to handle the gh-pages branch is to create an orphan branch:

git checkout --orphan gh-pages
rm (everything except demo)
mv demo/* .
git add .
git commit -m "adding content to gh-pages"
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top