Aidan Van Dyk wrote:
With git, you pull down the complete *history* of whatever branch, tag,
or reference you want to pull down.

You can do a so-called shallow clone, pulling only X most recent commits, with "git clone --depth=X". There's some limitations on what you can do with a shallow clone, but it's good enough for most purposes: you can create your own branches, merge and rebase them with upstream and create diffs.

 The *default* "clone" options are
setup to pull down the history of all available branches and tags, but
that's not mandatory.

Right.

Here's how to create a shallow clone with just the five most recent commits, with master-branch only:

~$ mkdir pgsql-shallow
~$ cd pgsql-shallow/
~/pgsql-shallow$ git-init
Initialized empty Git repository in /home/hlinnaka/pgsql-shallow/.git/
~/pgsql-shallow$ git-remote add origin -t master git://git.postgresql.org/git/postgresql.git
~/pgsql-shallow$ git-fetch origin --depth=5
remote: Counting objects: 3646, done.
remote: Compressing objects: 100% (2247/2247), done.
remote: Total 3646 (delta 1567), reused 2334 (delta 1317)
Receiving objects: 100% (3646/3646), 15.77 MiB | 508 KiB/s, done.
Resolving deltas: 100% (1567/1567), done.
From git://git.postgresql.org/git/postgresql
 * [new branch]      master     -> origin/master

Not as straightforward as a plain git-clone, but it's possible. The resulting repository is ~16 MB, which isn't very much even across a crappy Internet connection.

And the benefit of having the whole history of the branch available, is
that you can work on the branch *and history* locally, committing,
inspecting, reviewing, without needing to go back over the net.

Yeah. Before switching to git, I kept an rsync'd copy of the CVS repository on my laptop anyway for those reasons.

--
  Heikki Linnakangas
  EnterpriseDB   http://www.enterprisedb.com

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to