threads / discuss / 8266

just fetching HEAD of repository

Subject: just fetching HEAD of repository

## tl;dr

4 messages between May 21, 2007 and May 25, 2007.

replies: 3people: 4as markdown or json

Stian Haklev· May 21, 2007, 09:01 UTC · lore

After checking all the docs, I am still wondering if there is a way to get only the last commit from a given git repository. Sometimes I really just want the latest code so I can compile it - and let's say they are not running gitweb, or it is not convenient to go to gitweb and ask for a tar package to be made? This is especially relevant in countries with slow internet connection - here in Indonesia it takes me an hour to clone the git repository for example, never mind let's say the Linux kernel.

Thank you Stian

Matthieu Moy· May 21, 2007, 09:08 UTC · re: Stian Haklev · lore

Re: just fetching HEAD of repository

"Stian Haklev" <shaklev@gmail.com> writes:
Show 8 quoted lines
> After checking all the docs, I am still wondering if there is a way to
> get only the last commit from a given git repository. Sometimes I
> really just want the latest code so I can compile it - and let's say
> they are not running gitweb, or it is not convenient to go to gitweb
> and ask for a tar package to be made? This is especially relevant in
> countries with slow internet connection - here in Indonesia it takes
> me an hour to clone the git repository for example, never mind let's
> say the Linux kernel.

You'll probably pay the price for not downloading the full history later, but yes, what you're looking for is called "shallow clone", and it's possible with the --depth option of git-clone (I personnally never tried it, though).

Side question: once you have a shallow clone, is it possible to "unshallow" it, that is, fetch the missing revisions?

-- 
Matthieu
Guilhem Bonnefille· May 23, 2007, 17:12 UTC · re: Stian Haklev · lore

Re: just fetching HEAD of repository

Are you looking for something to "shallow clone" the remote git repo (as replyed by Matthieu, or something more similar to the "cvs export" or "svn export" commands (ie exporting a current snapshot, not a working repo)?

On 5/21/07, Stian Haklev <shaklev@gmail.com> wrote:
Show 16 quoted lines
> After checking all the docs, I am still wondering if there is a way to
> get only the last commit from a given git repository. Sometimes I
> really just want the latest code so I can compile it - and let's say
> they are not running gitweb, or it is not convenient to go to gitweb
> and ask for a tar package to be made? This is especially relevant in
> countries with slow internet connection - here in Indonesia it takes
> me an hour to clone the git repository for example, never mind let's
> say the Linux kernel.
>
> Thank you
> Stian
> -
> To unsubscribe from this list: send the line "unsubscribe git" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>
-- 
Guilhem BONNEFILLE
-=- #UIN: 15146515 JID: guyou@im.apinc.org MSN: guilhem_bonnefille@hotmail.com
-=- mailto:guilhem.bonnefille@gmail.com
-=- http://nathguil.free.fr/
Jakub Narebski· May 25, 2007, 10:56 UTC · re: Stian Haklev · lore

Re: just fetching HEAD of repository

Stian Haklev wrote:
Show 8 quoted lines
> After checking all the docs, I am still wondering if there is a way to
> get only the last commit from a given git repository. Sometimes I
> really just want the latest code so I can compile it - and let's say
> they are not running gitweb, or it is not convenient to go to gitweb
> and ask for a tar package to be made? This is especially relevant in
> countries with slow internet connection - here in Indonesia it takes
> me an hour to clone the git repository for example, never mind let's
> say the Linux kernel.
Depending on what you want, try either:
  $ git clone --depth=1 <repository URL>
or
  $ git archive --remote=<repository URL> HEAD
(if the remote side supports it)
-- 
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git

← back to recent threads