I am working on a project for my studies, and now I also have a group of students that will be adding functionality to the project. Since I don’t trust their changes, I want them to work on a different repository than me (but I am part of their project). My repository is at github, and I also want them to work with github.
The correct (github) way to do this would be to fork the project. But github does not allow me to fork my own project. I tried to forke my own project manually as described here, but while my original project has a number of branches, the new project has only one branch.
What I finally did was to create (locally) a new remote repository (the second github repo) and pushed all my local repo to the new remote repo.
Doing all this I got very confused on the real internals of git. For example: When I clone a new repository I get one master branch which points to the remote’s master branch. If I then go and push this local repository to a new remote repository, this remote repo will only have one branch! So how can we say that each git repository contains the same information? What is wrong in my line of though?
Thanks, and sorry for the long post.
When you clone a git repo, you get the entire repo. Unlike other vcs like SVN in which case you only get a working directory, you get the repo. The reason you don’t see any other branches normally is because you don’t have local tracking branches for them ( only master is setup by default.) You can see all the branches with
git branch -aand checkout any branch you want likegit checkout branch. If you push THIS repo, now you will have the branches.