# just fetching HEAD of repository

4 messages from 2007-05-21 to 2007-05-25. Participants: Stian Haklev, Matthieu Moy, Guilhem Bonnefille, Jakub Narebski.
Thread: https://gitlist.dev/t/8266

## Stian Haklev, 2007-05-21 09:01

Subject: just fetching HEAD of repository
Message-ID: <566574ef0705210201wc5c0adbmaa22d197b16bf72d@mail.gmail.com>
URL: https://gitlist.dev/e/566574ef0705210201wc5c0adbmaa22d197b16bf72d%40mail.gmail.com

```
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, 2007-05-21 09:08

Subject: Re: just fetching HEAD of repository
Message-ID: <vpqhcq6fsr9.fsf@bauges.imag.fr>
URL: https://gitlist.dev/e/vpqhcq6fsr9.fsf%40bauges.imag.fr
In-Reply-To: <566574ef0705210201wc5c0adbmaa22d197b16bf72d@mail.gmail.com>

```
"Stian Haklev" <shaklev@gmail.com> writes:

> 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, 2007-05-23 17:12

Subject: Re: just fetching HEAD of repository
Message-ID: <8b65902a0705231012p7b711094qc855a2805f2fd255@mail.gmail.com>
URL: https://gitlist.dev/e/8b65902a0705231012p7b711094qc855a2805f2fd255%40mail.gmail.com
In-Reply-To: <566574ef0705210201wc5c0adbmaa22d197b16bf72d@mail.gmail.com>

```
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:
> 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, 2007-05-25 10:56

Subject: Re: just fetching HEAD of repository
Message-ID: <f36f3t$teg$1@sea.gmane.org>
URL: https://gitlist.dev/e/f36f3t%24teg%241%40sea.gmane.org
In-Reply-To: <566574ef0705210201wc5c0adbmaa22d197b16bf72d@mail.gmail.com>

```
Stian Haklev wrote:

> 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

```
