开发者

Git Add Without Directory?

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 th开发者_JAVA技巧e contents of /demo without the directory itself. Is there any way to do this?


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"
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜