Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Progress indicator for git clone

Is it possible to get a progress bar when doing a git clone? I'm wondering because I am currently doing a git clone that has taken a few minutes so far and would be curious to know if it is going to finish soon.

like image 725
Olivier Lalonde Avatar asked Jan 09 '11 15:01

Olivier Lalonde


People also ask

Can git clone be tracked?

Cloning a Repository. The git clone command initializes a new repository with the contents of another one and sets up tracking branches in the new repository so that you can easily coordinate changes between the two with the push/pull mechanism.

How do I speed up git clones?

To speed up git clone make sure you set the `--depth` option to 1 so you don't get the entire repository history. This is *very* useful when cloning repos in your CI. In a scripted Jenkins pipeline you can achieve this with a single property.

Does git clone get all history?

Cloning an entire repo is standard operating procedure using Git. Each clone usually includes everything in a repository. That means when you clone, you get not only the files, but every revision of every file ever committed, plus the history of each commit.


1 Answers

Not really. There are various stages to git clone:

  1. discover the objects that need to be sent ("Counting objects: nnn")
  2. compress and send those objects
  3. index the received pack
  4. check out received files

Stage 1 involves walking through the commit graph from each branch head finding all the commits and associated objects: since there is no idea beforehand of how many commits there are, the progress of this can't be gauged. Sadly this is often where a lot of the time in a clone operation is taken up.

Stage 2 does have a progress counter, although it counts objects rather than volume (so its rate varies, especially if the repo has large blobs)

Stages 3 and 4 have progress counters, although they are usually much faster than the previous two stages.

like image 163
araqnid Avatar answered Oct 05 '22 08:10

araqnid