Fastest way to fetch specific commit from (outdated) full clone?

Viewed 41

I have a full clone of a repo, which is slightly outdated.

# A few days ago:
git clone url/foo.git

Now I'd like to fetch and checkout a new commit which is not part of the cloned repository yet.

I can do:

git fetch && git checkout 409b7405

I assume running this will be faster as it downloads less data:

git fetch 409b7405 && git checkout 409b7405

Will it be even faster when fetching with --depth=1?

git fetch --depth=1 409b7405 && git checkout 409b7405

Notes:

  • The use case is running something on a temporary cloud server instance, so everything will be deleted after running the job, and no further fetches will ever happen on the repository.
  • I'm really just worried about total time, so I'm wondering if --depth=1 might need more CPU on server or client side to run, negating any network saving (in case of a fast network).
0 Answers
Related