git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] docs: clarify that --depth for git-fetch works with newly initialized repos

From
Sebastian Schuberth <sschuberth@gmail.com>
Date
Jan 8, 2016, 09:32 UTC
Message-ID
<568F8244.2030309@gmail.com>
In-Reply-To
<n6j1cs$p4$1@ger.gmane.org>

The original wording sounded as if --depth could only be used to deepen or shorten the history of existing repos. However, that is not the case. In a workflow like

    $ git init
    $ git remote add origin https://github.com/git/git.git
    $ git fetch --depth=1
The newly initialized repo is properly created as a shallow repo.
---
 Documentation/fetch-options.txt | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/Documentation/fetch-options.txt b/Documentation/fetch-options.txt
index 45583d8..78cd265 100644
--- a/Documentation/fetch-options.txt
+++ b/Documentation/fetch-options.txt
@@ -8,10 +8,11 @@
 	option old data in `.git/FETCH_HEAD` will be overwritten.
 
 --depth=<depth>::
-	Deepen or shorten the history of a 'shallow' repository created by
-	`git clone` with `--depth=<depth>` option (see linkgit:git-clone[1])
-	to the specified number of commits from the tip of each remote
-	branch history. Tags for the deepened commits are not fetched.
+	Limit fetching to the specified number of commits from the tip of
+	each remote branch history. If fetching to a 'shallow' repository
+	created by `git clone` with `--depth=<depth>` option (see
+	linkgit:git-clone[1]), deepen or shorten the history to the specified
+	number of commits. Tags for the deepened commits are not fetched.
 
 --unshallow::
 	If the source repository is complete, convert a shallow
-- 
2.7.0.windows.1
Previous: Sebastian SchuberthNext: Sebastian Schuberth
Message 8 of 9 in “Questions on passing --depth to git-clone vs. git-fetch”
  1. Sebastian SchuberthJan 6, 2016
  2. Duy NguyenJan 6, 2016
  3. Sebastian SchuberthJan 6, 2016
  4. docs: clarify that passing --depth to git-clone implies --single-branchSebastian Schuberth, Jan 6, 2016
  5. Junio C HamanoJan 7, 2016
  6. docs: say "commits" in the --depth option wording for git-cloneSebastian Schuberth, Jan 8, 2016
  7. Sebastian SchuberthJan 13, 2016
  8. docs: clarify that --depth for git-fetch works with newly initialized reposSebastian Schuberth, Jan 8, 2016
  9. Sebastian SchuberthJan 13, 2016

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.