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

[PATCH v3 1/4] Documentation/git-bundle.txt: mention full backup example

From
Kkristofferhaugsbakk@fastmail.com <kristofferhaugsbakk@fastmail.com>
Date
Nov 7, 2024, 11:57 UTC
Message-ID
<b222c6787a79c852442969721dadc629ca84cd5b.1730979849.git.code@khaugsbakk.name>
In-Reply-To
<cover.1730979849.git.code@khaugsbakk.name>
From: Kristoffer Haugsbakk <code@khaugsbakk.name>

Provide an example about how to make a “full backup” with caveats about what that means in this case.

This is a requested use-case.[1] But the doc is a bit unassuming about it:

    If you want to match `git clone --mirror`, which would include your
    refs such as `refs/remotes/*`, use `--all`.

The user cannot be expected to formulate “I want a full backup” as “I want to match `git clone --mirror`” for a bundle file or something. Let’s drop this mention of `--all` later in the doc and frontload it.

† 1: E.g.:
    • https://stackoverflow.com/questions/5578270/fully-backup-a-git-repo
    • https://stackoverflow.com/questions/11792671/how-to-git-bundle-a-complete-repo
Helped-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Kristoffer Haugsbakk <code@khaugsbakk.name>
---
Notes (series):
    v3:
    • Elaborate on “full backups” in Examples instead
    • Just point to the section in the second paragraph where everything is
      elaborated
    • Incorporate some of Junio’s suggestions:
      • Mention what the “full backup” here does not include
    
        Link: https://lore.kernel.org/git/xmqqh68q1l37.fsf@gitster.g/
        Link: https://lore.kernel.org/git/xmqqzfmiza69.fsf@gitster.g/#t
    • Remove the final paragraph pointing to Examples now that we mention it
      in the second paragraph
    v2:
    • Mention as a parenthetical on an existing paragraph (don’t create a
      new sentence and paragraph)
    • Remove the “mirror” mention
    
      Link (both): https://lore.kernel.org/git/ZxbIWEGS1UB3UIg+@nand.local/
Notes (meta-trailers):
    Helped-by: Junio C Hamano <gitster@pobox.com>
        Link: https://lore.kernel.org/git/xmqqzfmiza69.fsf@gitster.g/
 Documentation/git-bundle.txt | 30 ++++++++++++++++++++++++------
 1 file changed, 24 insertions(+), 6 deletions(-)
diff --git a/Documentation/git-bundle.txt b/Documentation/git-bundle.txt
index 3ab42a19cae..f39cafee927 100644
--- a/Documentation/git-bundle.txt
+++ b/Documentation/git-bundle.txt
@@ -23,8 +23,9 @@ the "offline" transfer of Git objects without an active "server"
 sitting on the other side of the network connection.
 
 They can be used to create both incremental and full backups of a
-repository, and to relay the state of the references in one repository
-to another.
+repository (see the "full backup" example in "EXAMPLES"), and to relay
+the state of the references in one repository to another (see the second
+example).
 
 Git commands that fetch or otherwise "read" via protocols such as
 `ssh://` and `https://` can also operate on bundle files. It is
@@ -34,8 +35,6 @@ contained within it with linkgit:git-ls-remote[1]. There's no
 corresponding "write" support, i.e.a 'git push' into a bundle is not
 supported.
 
-See the "EXAMPLES" section below for examples of how to use bundles.
-
 BUNDLE FORMAT
 -------------
 
@@ -216,8 +215,27 @@ bundle.
 EXAMPLES
 --------
 
-Assume you want to transfer the history from a repository R1 on machine A
-to another repository R2 on machine B.
+We'll discuss two cases:
+
+1. Taking a full backup of a repository
+2. Transfer the history of a repository to another machine when the two
+   machines have no direct connection
+
+First let's consider a full backup of the repository.  The following
+command will take a full backup of the repository in the sense that all
+refs are included in the bundle (except `refs/stash`, i.e. the stash):
+
+----------------
+$ git bundle create <file> --all
+----------------
+
+But note again that this is only for the refs, i.e. you will only
+include refs and commits reachable from those refs.  You will not
+include other local state, such as the contents of the index, working
+tree, per-repository configuration, hooks, etc.
+
+For the next example, assume you want to transfer the history from a
+repository R1 on machine A to another repository R2 on machine B.
 For whatever reason, direct connection between A and B is not allowed,
 but we can move data from A to B via some mechanism (CD, email, etc.).
 We want to update R2 with development made on the branch master in R1.
-- 
2.46.1.641.g54e7913fcb6
Previous: kristofferhaugsbakk@fastmail.comNext: Junio C Hamano
Message 23 of 37 in “Documentation/git-bundle.txt: promote --all for full backup”
  1. 0/4 Documentation/git-bundle.txt: promote --all for full backupkristofferhaugsbakk@fastmail.com, Oct 20, 2024
  2. 1/4 Documentation/git-bundle.txt: mention --all in Synopsiskristofferhaugsbakk@fastmail.com, Oct 20, 2024
  3. Kristoffer HaugsbakkOct 20, 2024
  4. Taylor BlauOct 21, 2024
  5. 2/4 Documentation/git-bundle.txt: mention full backup examplekristofferhaugsbakk@fastmail.com, Oct 20, 2024
  6. Taylor BlauOct 21, 2024
  7. Kristoffer HaugsbakkOct 22, 2024
  8. 3/4 Documentation/git-bundle.txt: mention --all in spec. refskristofferhaugsbakk@fastmail.com, Oct 20, 2024
  9. Taylor BlauOct 21, 2024
  10. 4/4 Documentation/git-bundle.txt: discuss naïve backupskristofferhaugsbakk@fastmail.com, Oct 20, 2024
  11. Taylor BlauOct 21, 2024
  12. Taylor BlauOct 22, 2024
  13. Kristoffer HaugsbakkOct 22, 2024
  14. 0/3 Documentation/git-bundle.txt: promote --all for full backupkristofferhaugsbakk@fastmail.com, Oct 29, 2024
  15. 1/3 Documentation/git-bundle.txt: mention full backup examplekristofferhaugsbakk@fastmail.com, Oct 29, 2024
  16. Junio C HamanoNov 2, 2024
  17. Kristoffer HaugsbakkNov 6, 2024
  18. 2/3 Documentation/git-bundle.txt: mention --all in spec. refskristofferhaugsbakk@fastmail.com, Oct 29, 2024
  19. 3/3 Documentation/git-bundle.txt: discuss naïve backupskristofferhaugsbakk@fastmail.com, Oct 29, 2024
  20. Junio C HamanoNov 2, 2024
  21. Taylor BlauOct 29, 2024
  22. 0/4 Documentation/git-bundle.txt: promote --all for full backupkristofferhaugsbakk@fastmail.com, Nov 7, 2024
  23. 1/4 Documentation/git-bundle.txt: mention full backup examplekristofferhaugsbakk@fastmail.com, Nov 7, 2024
  24. Junio C HamanoNov 8, 2024
  25. Kristoffer HaugsbakkNov 10, 2024
  26. Kristoffer HaugsbakkNov 12, 2024
  27. Junio C HamanoNov 12, 2024
  28. Kristoffer HaugsbakkNov 16, 2024
  29. 2/4 Documentation/git-bundle.txt: remove old `--all` examplekristofferhaugsbakk@fastmail.com, Nov 7, 2024
  30. 3/4 Documentation/git-bundle.txt: mention --all in spec. refskristofferhaugsbakk@fastmail.com, Nov 7, 2024
  31. 4/4 Documentation/git-bundle.txt: discuss naïve backupskristofferhaugsbakk@fastmail.com, Nov 7, 2024
  32. Junio C HamanoNov 7, 2024
  33. 0/4 Documentation/git-bundle.txt: promote --all for full backupkristofferhaugsbakk@fastmail.com, Nov 16, 2024
  34. 1/4 Documentation/git-bundle.txt: mention full backup examplekristofferhaugsbakk@fastmail.com, Nov 16, 2024
  35. 2/4 Documentation/git-bundle.txt: remove old `--all` examplekristofferhaugsbakk@fastmail.com, Nov 16, 2024
  36. 3/4 Documentation/git-bundle.txt: mention --all in spec. refskristofferhaugsbakk@fastmail.com, Nov 16, 2024
  37. 4/4 Documentation/git-bundle.txt: discuss naïve backupskristofferhaugsbakk@fastmail.com, Nov 16, 2024

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.