Reputation: 42389
I've setup a Github
repo where I've committed some code to the master
branch. I then created a page with Github
's own page creator, which generated a new branch alongside the master
branch called gh-pages
. I've pushed lots of commits to both branches by now.
The issue I have is that when I switch from master
to gh-pages
I can see files and folders from master
that shouldn't be showing (I think) in the gh-pages
branch.
I've read here that to stop that from happening the following commands should be used within the gh-pages
branch:
git symbolic-ref HEAD refs/heads/gh-pages
rm .git/index
git clean -fdx
I'm not sure what those commands do so I don't want to use them until I'm sure they won't screw up neither branch and that they actually will fix the issue I have with files and folders from master
showing in gh-pages
.
Could you explain what these commands do and whether they are suited to fix the issue mentioned above?
Upvotes: 2
Views: 1076
Reputation: 194
You are telling that HEAD refs/heads/gh-pages is your current working branch by creating a symlink called HEAD with the refs/heads/gh-pages value
git symbolic-ref HEAD refs/heads/gh-pages
then you are removing the index file of git
rm .git/index
finally you are cleaning your untracked files
git clean -fdx
Upvotes: 4