Why is it necessary to lose raw files when setting up github pages?

Github has a feature that allows you to host HTML pages. ( Details here ).

Anyway, I recently used this to bring up the above page. The basis of the instructions for this are:

// In order to create a new root branch, first ensure that your working directory is clean by committing or stashing any changes. The following operation will lose any uncommitted files! You might want to run this in a fresh clone of your repo.

$ cd /path/to/fancypants
$ git symbolic-ref HEAD refs/heads/gh-pages
$ rm .git/index
$ git clean -fdx

// After running this you’ll have an empty working directory (don’t worry, your main repo is still on the master branch). Now you can create some content in this branch and push it to GitHub. For example:

$ echo "My GitHub Page" > index.html
$ git add .
$ git commit -a -m "First pages commit"
$ git push origin gh-pages

So everything went well; as announced, my unsolicited files were wiped, but I made a copy of the directory and just returned, which was necessary. Switching between branches (I use SmartGit) does not seem to destroy irreproducible files.

, Git, , gh-. , gh-pages, html , . .

+5
4

, . , , git checkout --orphan gh-pages

+4

gh-pages , git clean git add <files> git add .. :

cd /path/to/fancypants
git symbolic-ref HEAD refs/heads/gh-pages
rm .git/index
echo "My GitHub Page" > index.html
git add index.html
git commit -a -m "First pages commit"
git push origin gh-pages

, , "".

+3

, git ( .html) . , ( ) , web-serve-on-github, html, css, javascript.

, , . , (git gh-) . , , , - , .

+1

The problem was git clean git cleandeleting any unprocessed file from the current working tree.

You can configure .gitignorefiles for files without a trace and leave a flag -x. You should look at the man page at git-clean. If you do not have a unix system: http://linux.die.net/man/1/git-clean

0
source

All Articles