3

After searching a lot I ask this.

I want to download the app source code from this url: https://android.googlesource.com/platform/packages/apps/Gallery2/+/ics-mr1

git clone https://android.googlesource.com/platform/packages/apps/Gallery2/+/ics-mr1 does not work.

git clone https://android.googlesource.com/platform/packages/apps/Gallery2/ works just fine.

What should I do to download the specific branch?

Avijit
  • 281
  • 2
  • 21

3 Answers3

10

Git clone download all the project, with --branch option:

--branch , -b Instead of pointing the newly created HEAD to the branch pointed to by the cloned repository’s HEAD, point to branch instead. In a non-bare repository, this is the branch that will be checked out.

git clone --branch ics-mr1 https://android.googlesource.com/platform/packages/apps/Gallery2

Hope this helps!

cortex
  • 4,996
  • 3
  • 30
  • 41
0

You clone the project and then you checkout the branch like:

git clone https://android.googlesource.com/platform/packages/apps/Gallery2
cd Gallery2/
git checkout ics-mr1
Fernando Diaz Garrido
  • 3,917
  • 18
  • 22
0

You can also download just one branch:

git init Gallery2_ics-mr1
cd Gallery2_ics-mr1
git remote add origin https://android.googlesource.com/platform/packages/apps/Gallery2
git fetch -n origin ics-mr1:refs/remotes/origin/ics-mr1
git checkout origin/ics-mr1 -b ics-mr1

Note that further git pull or git fetch (without parameters) will fetch everything else from the repository.

Vi.
  • 33,936
  • 16
  • 92
  • 141