Githubには、HTMLページを置くことができる機能があります。 (Details here)。githubページを設定するときに、untrackedファイルを失うことが必要なのはなぜですか?
とにかく、私は最近、上記のページを置くためにこれを使用しました。その手順の基本は次のとおりです。
// 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
宣伝されているように、私の未追跡のファイルは消去されましたが、私はdirのコピーを作成し、必要なものだけを戻しました。ブランチ間での切り替え(私はSmartGitを使用しています)は、未追跡のファイルを消去していないようです。
しかし、私はGitの基本的な知識を広げたいと思っています。なぜgh-pagesが初めて設定されたときに、未追跡のファイルを拭く必要があるのだろうと思います。 gh-pagesブランチをセットアップし、htmlファイルを追加してコミットし、それをプッシュすることが可能であると思ったでしょう。そして元のブランチに戻ってください。
皆さん、ありがとうございました。彼らはすべて私に大変感謝しているgitについてもっと教えてくれました。 –
問題はありません@ケネス・マクドナルド、答えの一つを受け入れることを忘れないでください。 –