git - Why is it necessary to lose untracked files when you set up github pages? -
github has feature can put html pages. (details here).
anyway, used put aforementioned page. basics of instructions are:
// in order create new root branch, first ensure working directory clean committing or stashing changes. following operation lose uncommitted files! might want run in fresh clone of repo. $ cd /path/to/fancypants $ git symbolic-ref head refs/heads/gh-pages $ rm .git/index $ git clean -fdx // after running you’ll have empty working directory (don’t worry, main repo still on master branch). can create content in branch , push github. example: $ echo "my github page" > index.html $ git add . $ git commit -a -m "first pages commit" $ git push origin gh-pages
so went fine; advertised, untracked files wiped i'd made copy of dir , moved necessary. switching , forth between branches (i use smartgit) doesn't seem wipe untracked files.
however, i'm interested in expanding basic knowledge of git, , wondering why necessary wipe untracked files first time gh-pages set up. have thought possible set gh-pages branch, add , commit html file , push it, without affecting untracked files. , switch original branch.
best bet, make new clone , in that. if absolutely must in repo you're working in, try git checkout --orphan gh-pages
Comments
Post a Comment