开发者

Git Add Without Directory?

开发者 https://www.devze.com 2023-04-02 17:02 出处:网络
My git repo\'s master branch structure is as follows /demo index.html style.css reset.css jquery.dimlights.js

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

精彩评论

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