From: Junio C Hamano <gitster@pobox.com>
To: kristofferhaugsbakk@fastmail.com
Cc: git@vger.kernel.org, Kristoffer Haugsbakk <code@khaugsbakk.name>,
avarab@gmail.com, me@ttaylorr.com
Subject: Re: [PATCH v3 1/4] Documentation/git-bundle.txt: mention full backup example
Date: Fri, 08 Nov 2024 11:01:56 +0900 [thread overview]
Message-ID: <xmqq1pzmqy97.fsf@gitster.g> (raw)
In-Reply-To: <b222c6787a79c852442969721dadc629ca84cd5b.1730979849.git.code@khaugsbakk.name> (kristofferhaugsbakk@fastmail.com's message of "Thu, 7 Nov 2024 12:57:33 +0100")
kristofferhaugsbakk@fastmail.com writes:
> +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
Contrasting (1) taking a backup and (2) extracting a backup later is
a very useful way to frame the problem, but then, I'd say
1. taking a backup, either full or incremental, of a repository
2. using the backup, either full or incremental, to transfer the
history of the origin repository to any repository (including
itself) without needing any other connection between the two
repositories.
Whether a full or an incremental, the resulting bundle file can be
used as an offline medium and then later extracted elsewhere, even
if there is no direct network connection between the origin
repository and the destination repository. But you can extract in
the origin repository as well.
But that would require a bit more surgery to the presentation order
of the text, so I do not mind deferrring it to a later and separate
series. If we were to go that route, it would be helpful to have a
paragraph to describe how you use your "full backup" bundle to recover
lost data from, though. To those of us who know what is happening,
there is not much difference between the extraction side of the
sneaker-net example, but as we framed the use in two distinct cases,
it would be helpful to make each case stand on its own.
> +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):
Are you sure the "except" part is factually correct?
I did
$ git bundle create x.bndl --all && git ls-remote x.bndl |
grep stash
and I see refs/stash listed there just fine. You should be able to
extract them all with
$ git clone --mirror x.bndl xxx && cd xxx && git for-each-ref |
grep stash
and see that refs/stash gets propagated.
Fix is a simple s/except/including/ ;-)
> +----------------
> +$ 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.
And to make each case stand on its own, we would want to teach
readers how to use the full backup to recover data from here, before
moving on to the "next example".
You can use the resulting bundle file as if it is a repository,
a snapshot of it at the time the bundle was created. You can
use
---
$ git ls-remote full.bndl
---
to inspect what refs are recorded in it, and you can fetch from or
even merge a branch out of it, with commands like:
---
$ git fetch full.bndl my-butchered-topic
$ git show-branch my-butchered-topic FETCH_HEAD
$ git branch -f my-butchered-topic FETCH_HEAD
$ git pull full.bndl my-butchered-topic
---
after you screwed up one of your branches and resurrect it from
the backup.
or something like that.
> +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.
next prev parent reply other threads:[~2024-11-08 2:01 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-20 19:14 [PATCH 0/4] Documentation/git-bundle.txt: promote --all for full backup kristofferhaugsbakk
2024-10-20 19:14 ` [PATCH 1/4] Documentation/git-bundle.txt: mention --all in Synopsis kristofferhaugsbakk
2024-10-20 19:33 ` Kristoffer Haugsbakk
2024-10-21 21:30 ` Taylor Blau
2024-10-20 19:15 ` [PATCH 2/4] Documentation/git-bundle.txt: mention full backup example kristofferhaugsbakk
2024-10-21 21:32 ` Taylor Blau
2024-10-22 21:18 ` Kristoffer Haugsbakk
2024-10-20 19:15 ` [PATCH 3/4] Documentation/git-bundle.txt: mention --all in spec. refs kristofferhaugsbakk
2024-10-21 21:33 ` Taylor Blau
2024-10-20 19:15 ` [PATCH 4/4] Documentation/git-bundle.txt: discuss naïve backups kristofferhaugsbakk
2024-10-21 21:36 ` [PATCH 0/4] Documentation/git-bundle.txt: promote --all for full backup Taylor Blau
2024-10-22 17:29 ` Taylor Blau
2024-10-22 21:22 ` Kristoffer Haugsbakk
2024-10-29 20:41 ` [PATCH v2 0/3] " kristofferhaugsbakk
2024-10-29 20:41 ` [PATCH v2 1/3] Documentation/git-bundle.txt: mention full backup example kristofferhaugsbakk
2024-11-02 1:27 ` Junio C Hamano
2024-11-06 19:31 ` Kristoffer Haugsbakk
2024-10-29 20:41 ` [PATCH v2 2/3] Documentation/git-bundle.txt: mention --all in spec. refs kristofferhaugsbakk
2024-10-29 20:41 ` [PATCH v2 3/3] Documentation/git-bundle.txt: discuss naïve backups kristofferhaugsbakk
2024-11-02 1:39 ` Junio C Hamano
2024-10-29 22:19 ` [PATCH v2 0/3] Documentation/git-bundle.txt: promote --all for full backup Taylor Blau
2024-11-07 11:57 ` [PATCH v3 0/4] " kristofferhaugsbakk
2024-11-07 11:57 ` [PATCH v3 1/4] Documentation/git-bundle.txt: mention full backup example kristofferhaugsbakk
2024-11-08 2:01 ` Junio C Hamano [this message]
2024-11-10 19:38 ` Kristoffer Haugsbakk
2024-11-12 17:31 ` Kristoffer Haugsbakk
2024-11-12 22:58 ` Junio C Hamano
2024-11-16 14:28 ` Kristoffer Haugsbakk
2024-11-07 11:57 ` [PATCH v3 2/4] Documentation/git-bundle.txt: remove old `--all` example kristofferhaugsbakk
2024-11-07 11:57 ` [PATCH v3 3/4] Documentation/git-bundle.txt: mention --all in spec. refs kristofferhaugsbakk
2024-11-07 11:57 ` [PATCH v3 4/4] Documentation/git-bundle.txt: discuss naïve backups kristofferhaugsbakk
2024-11-07 16:36 ` [PATCH v3 0/4] Documentation/git-bundle.txt: promote --all for full backup Junio C Hamano
2024-11-16 14:54 ` [PATCH v4 " kristofferhaugsbakk
2024-11-16 14:54 ` [PATCH v4 1/4] Documentation/git-bundle.txt: mention full backup example kristofferhaugsbakk
2024-11-16 14:54 ` [PATCH v4 2/4] Documentation/git-bundle.txt: remove old `--all` example kristofferhaugsbakk
2024-11-16 14:54 ` [PATCH v4 3/4] Documentation/git-bundle.txt: mention --all in spec. refs kristofferhaugsbakk
2024-11-16 14:54 ` [PATCH v4 4/4] Documentation/git-bundle.txt: discuss naïve backups kristofferhaugsbakk
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqq1pzmqy97.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=avarab@gmail.com \
--cc=code@khaugsbakk.name \
--cc=git@vger.kernel.org \
--cc=kristofferhaugsbakk@fastmail.com \
--cc=me@ttaylorr.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).