From: Junio C Hamano <gitster@pobox.com>
To: Paul Kinzelman <paul@kinzelman.com>
Cc: git@vger.kernel.org
Subject: Re: moving a repository question
Date: Thu, 14 Jul 2022 15:59:55 -0700 [thread overview]
Message-ID: <xmqqilnz2tck.fsf@gitster.g> (raw)
In-Reply-To: <2e592944-edb8-2d49-981a-8ad220f97e82@kinzelman.com> (Paul Kinzelman's message of "Thu, 14 Jul 2022 16:06:34 -0600")
Paul Kinzelman <paul@kinzelman.com> writes:
> I barely qualify as a novice on git, so my apologies in advance if this is a
> stupid question.
>
> Is everything that git needs stored in the .git tree?
Depends on what you want to do with "Git".
If you only copy .git/ and no file from the working tree, your "git
status" in the new location will report "you removed all the files
and you have nothing", for example. If you are willing to do "git
reset --hard" after making such a copy of ".git/", it may be OK. If
you had local changes in the working tree before taking a copy of
.git/, doing "git reset --hard" in the new location may not recover
the local changes in the original, so it may not be good and you may
have to copy the working tree files as well.
If you are using multiple worktrees linked to the repository,
copying .git/ is an absolute no-no. Locations of secondary
worktrees are recorded in .git/ somewhere and copying them literally
would mean the new copy would mistakenly think that these secondary
worktrees linked to the original repository are linked to the new
copy instead. There may be other things that will cause confusions
when copied.
"git clone" will of course sidestep all of these problems.
next prev parent reply other threads:[~2022-07-14 23:00 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-14 22:06 moving a repository question Paul Kinzelman
2022-07-14 22:59 ` Junio C Hamano [this message]
2022-07-15 16:59 ` Paul Kinzelman
2022-07-15 18:27 ` RDP over VPN can't see a .git directory to be able to pull Paul Kinzelman
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=xmqqilnz2tck.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=paul@kinzelman.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).