Id: Readme / Installation: How to checkout branch when using depth=1

Created on 31 Aug 2018  路  3Comments  路  Source: openstreetmap/iD

In https://github.com/openstreetmap/iD#installation it is described to use git clone --depth=1 https://github.com/openstreetmap/iD.git

I could not checkout the branch keep-right_QA afterwards. How can I force-checkout a branch?

I re-cloned the full repository which solved the problem.


By the way: The full repos seems to be just 240 MB which does not feel to bad, so maybe the depth-thing is not needed?

question

All 3 comments

Hey @tordans !!
This behavior is correct, a shallow clone (with the depth-option) only fetches one single branch (at your requested depth).
If you want to fetch other branches re-cloning the full repository is a good solution. If you still wish to fetch all branches in your shallow clone use the following commands.
git remote set-branches origin '*' (You can also use git remote set-branches origin '*' for all branches, replace the * with a branch name for one)
git fetch -v
git checkout keep-right_QA

PS: It makes less sense for me though, I would simply re-clone.

If you want to test one specific branch on a new clone you could run
git clone --depth=1 https://github.com/openstreetmap/iD.git -b keep-right_QA

Using depth=1 for me took 2.8 seconds, whereas a full clone took 30.8.

Thanks for the help.

I still wonder if this added complexity is worth having the depth-thing explained as a "regular" solution on the installation page.

I will close this.

Was this page helpful?
0 / 5 - 0 ratings