Skip to content

Commit df0cf6f

Browse files
LemmingAvalanchegitster
authored andcommitted
Documentation/git-bundle.txt: mention full backup example
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-repohttps://stackoverflow.com/questions/11792671/how-to-git-bundle-a-complete-repo Helped-by: Junio C Hamano <[email protected]> Signed-off-by: Kristoffer Haugsbakk <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 34b6ce9 commit df0cf6f

File tree

1 file changed

+31
-6
lines changed

1 file changed

+31
-6
lines changed

Documentation/git-bundle.txt

Lines changed: 31 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,9 @@ the "offline" transfer of Git objects without an active "server"
2323
sitting on the other side of the network connection.
2424

2525
They can be used to create both incremental and full backups of a
26-
repository, and to relay the state of the references in one repository
27-
to another.
26+
repository (see the "full backup" example in "EXAMPLES"), and to relay
27+
the state of the references in one repository to another (see the second
28+
example).
2829

2930
Git commands that fetch or otherwise "read" via protocols such as
3031
`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
3435
corresponding "write" support, i.e.a 'git push' into a bundle is not
3536
supported.
3637

37-
See the "EXAMPLES" section below for examples of how to use bundles.
38-
3938
BUNDLE FORMAT
4039
-------------
4140

@@ -216,8 +215,34 @@ bundle.
216215
EXAMPLES
217216
--------
218217

219-
Assume you want to transfer the history from a repository R1 on machine A
220-
to another repository R2 on machine B.
218+
We'll discuss two cases:
219+
220+
1. Taking a full backup of a repository
221+
2. Transferring the history of a repository to another machine when the
222+
two machines have no direct connection
223+
224+
First let's consider a full backup of the repository. The following
225+
command will take a full backup of the repository in the sense that all
226+
refs are included in the bundle:
227+
228+
----------------
229+
$ git bundle create backup.bundle --all
230+
----------------
231+
232+
But note again that this is only for the refs, i.e. you will only
233+
include refs and commits reachable from those refs. You will not
234+
include other local state, such as the contents of the index, working
235+
tree, the stash, per-repository configuration, hooks, etc.
236+
237+
You can later recover that repository by using for example
238+
linkgit:git-clone[1]:
239+
240+
----------------
241+
$ git clone backup.bundle <new directory>
242+
----------------
243+
244+
For the next example, assume you want to transfer the history from a
245+
repository R1 on machine A to another repository R2 on machine B.
221246
For whatever reason, direct connection between A and B is not allowed,
222247
but we can move data from A to B via some mechanism (CD, email, etc.).
223248
We want to update R2 with development made on the branch master in R1.

0 commit comments

Comments
 (0)