I have a git repository (at github.com) with two branches: master and gh-pages. I would like to have the gh-pages branch in a subdirectory, so that I don't need to switch branches every time.
repo/ (content of the master branch) gh-pages/ (content of the gh-pages branch)
Is that possible ?
In Source Control Explorer, right-click the folder or file that you want to branch, point to Branching and Merging, and then click Branch.
Git doesn't really have a concept of sub-branches. Right now, all of your branches will show up in that dropdown if they have been pushed up to Bitbucket. Yes, It is possible to create a sub-branch in bitbucket.
It will add all the Folders , Subfolders and files to the existing repo.
But if we add the -a flag to show everything, we can see that Git has created a hidden directory within planets called .git : $ ls -a. . .. . git. Git uses this special subdirectory to store all the information about the project, including the tracked files and sub-directories located within the project's directory.
You may be looking for the subtree merging option.
It will let you checkout an unrelated branch into a subdirectory of another and then merge back and forth between them. You would still have to checkout gh-pages and merge in changes from the main repo before pushes would go live on GitHub, however.
You could also check gh-pages out as a submodule of your master branch if that suits you better.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With