Git: pull out a specific branch, save only the last tree (without any history)

How can I pull a specific branch from a remote repository, checking only the last tree without saving history?

This question is specifically related to checking the Gentoo Portage tree: I would like to update my Portage tree without saving any history, minimizing size /usr/portage/.git.

+4
source share
2 answers

Like this:

$ git clone --branch dotnet-mono-eclass-lat --depth 1 https://anongit.gentoo.org/git/repo/gentoo.git

From man git-clone:

- branch <name>, -b <name>

, HEAD , HEAD,   < name. , .

- <depth>

, .   ( ,  ), ,   .

+2

: git clone --depth 1

:

git pull --depth 1 git pull --update-shallow

+2
source

Source: https://habr.com/ru/post/1627919/


All Articles