I am trying to understand how GitHub works, in terms of makings commits from different branches. I am looking at a repository which I want to clone. Let's say the address is https://github.com/dartsim/alpha
. Now, there are two branches: Master
, and V2
, and the code I want is in the V2
branch. If I navigate the V2
file structure in the GitHub website, it takes me to the address https://github.com/dartsim/dart/tree/V2
. Now, if I download the ZIP file from this webpage, it gives me the V2
code as needed. However, on this same V2
webpage, it also shows the address to use if you want to clone the repository, which is shown as https://github.com/alpha/alpha.git
. However, when I clone this, it downloads the code from the old Master
branch, rather than the V2
branch.
Please could somebody explain why this webpage is not showing a download link for the V2
branch? Why is this default download link for the old version of the code, rather than the newer version? Thanks!
The default branch is by default 'master' - but you can set that up in the Github repository settings page.
The download link at Github is a snapshot of the active branch - a git export.
Git is distributed and that means that when you clone, you get a complete copy of the repository, all branches/tags/whatever included.
You can list the branches by running git branch
and switch to a branch by doing git checkout name-of-branch
.
If you want a quick tutorial on git, see git - the simple guide
And, of course, you ought to read the official git docs (they are great):
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.