* Re: Git question. Is there a way of duplicating a git repository?
2015-11-14 11:20 Git question. Is there a way of duplicating a git repository? Alan Mackenzie
@ 2015-11-14 17:03 ` Achim Gratz
2015-11-14 17:06 ` Dmitry Gutov
` (11 subsequent siblings)
12 siblings, 0 replies; 19+ messages in thread
From: Achim Gratz @ 2015-11-14 17:03 UTC (permalink / raw)
To: emacs-devel
Alan Mackenzie writes:
> Or I could clone my master repository to make emacs-25. But this would
> make the new repo firmly subordinate to the master repo, rather than
> directly with savannah.
So what, simply copy over the .git/config file from your "master" repo
after you've done cloning.
Regards,
Achim.
--
+<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+
Samples for the Waldorf Blofeld:
http://Synth.Stromeko.net/Downloads.html#BlofeldSamplesExtra
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: Git question. Is there a way of duplicating a git repository?
2015-11-14 11:20 Git question. Is there a way of duplicating a git repository? Alan Mackenzie
2015-11-14 17:03 ` Achim Gratz
@ 2015-11-14 17:06 ` Dmitry Gutov
2015-11-15 10:43 ` Alan Mackenzie
2015-11-14 17:20 ` Liang Wang
` (10 subsequent siblings)
12 siblings, 1 reply; 19+ messages in thread
From: Dmitry Gutov @ 2015-11-14 17:06 UTC (permalink / raw)
To: Alan Mackenzie, emacs-devel
On 11/14/2015 01:20 PM, Alan Mackenzie wrote:
> So, is there any convenient way of duplicating a repo (using hard links,
> and preserving config info)?
See http://nuclearsquid.com/writings/git-new-workdir/.
However, considering your attitude to learning Git internals, maybe you
should just use one of the two already two methods that you've already
mentioned, and live with its drawbacks.
git-new-workdir worked fine for me, though, last I tried.
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: Git question. Is there a way of duplicating a git repository?
2015-11-14 17:06 ` Dmitry Gutov
@ 2015-11-15 10:43 ` Alan Mackenzie
0 siblings, 0 replies; 19+ messages in thread
From: Alan Mackenzie @ 2015-11-15 10:43 UTC (permalink / raw)
To: Dmitry Gutov; +Cc: emacs-devel
Hello, Dmitry.
On Sat, Nov 14, 2015 at 07:06:20PM +0200, Dmitry Gutov wrote:
> On 11/14/2015 01:20 PM, Alan Mackenzie wrote:
> > So, is there any convenient way of duplicating a repo (using hard links,
> > and preserving config info)?
> See http://nuclearsquid.com/writings/git-new-workdir/.
I had a look at that site, thanks.
> However, considering your attitude to learning Git internals, maybe you
> should just use one of the two already two methods that you've already
> mentioned, and live with its drawbacks.
Just to clarify that attitude: I'm most unhappy about the fact that I
need to learn about git internals to be able to get work done; I'd far
prefer just to be a git user. However, when it is necessary to dive
into the internals, I do it.
> git-new-workdir worked fine for me, though, last I tried.
With the help of suggestions from Ken Brown, I've managed to get the
setup I want.
--
Alan Mackenzie (Nuremberg, Germany).
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: Git question. Is there a way of duplicating a git repository?
2015-11-14 11:20 Git question. Is there a way of duplicating a git repository? Alan Mackenzie
2015-11-14 17:03 ` Achim Gratz
2015-11-14 17:06 ` Dmitry Gutov
@ 2015-11-14 17:20 ` Liang Wang
2015-11-14 17:27 ` Ivan Shmakov
` (9 subsequent siblings)
12 siblings, 0 replies; 19+ messages in thread
From: Liang Wang @ 2015-11-14 17:20 UTC (permalink / raw)
To: Alan Mackenzie; +Cc: emacs-devel
On Sat, Nov 14, 2015 at 3:20 AM, Alan Mackenzie <acm@muc.de> wrote:
>
> Hello, Emacs.
>
> Now that we've cut the emacs-25 release branch, I'd like to have a
> distinct repository for this.
>
> I could simply download another copy from savannah, but this would
> (presumably) be a distinct copy, rather than hard linking the repository
> files. This would cost me disk (and backup) space.
>
> Or I could clone my master repository to make emacs-25. But this would
> make the new repo firmly subordinate to the master repo, rather than
> directly with savannah.
>
> So, is there any convenient way of duplicating a repo (using hard links,
> and preserving config info)?
https://github.com/git/git/blob/master/contrib/workdir/git-new-workdir
might help.
>
> --
> Alan Mackenzie (Nuremberg, Germany).
>
Thanks,
Liang.
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: Git question. Is there a way of duplicating a git repository?
2015-11-14 11:20 Git question. Is there a way of duplicating a git repository? Alan Mackenzie
` (2 preceding siblings ...)
2015-11-14 17:20 ` Liang Wang
@ 2015-11-14 17:27 ` Ivan Shmakov
2015-11-14 17:37 ` David Reitter
` (8 subsequent siblings)
12 siblings, 0 replies; 19+ messages in thread
From: Ivan Shmakov @ 2015-11-14 17:27 UTC (permalink / raw)
To: emacs-devel
>>>>> Alan Mackenzie <acm@muc.de> writes:
> Now that we've cut the emacs-25 release branch, I'd like to have a
> distinct repository for this.
> I could simply download another copy from savannah, but this would
> (presumably) be a distinct copy, rather than hard linking the
> repository files. This would cost me disk (and backup) space.
> Or I could clone my master repository to make emacs-25. But this
> would make the new repo firmly subordinate to the master repo, rather
> than directly with savannah.
> So, is there any convenient way of duplicating a repo (using hard
> links, and preserving config info)?
I didn’t test it, but given that said subordination is just a
matter of a few lines in the respective .git/config, something
along the lines below is ought to work.
$ git clone -- emacs-1 emacs-2
$ cp --backup=t -- emacs-1/.git/config emacs-2/.git/config
$
--
FSF associate member #7257 http://am-1.org/~ivan/ … 3013 B6A0 230E 334A
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: Git question. Is there a way of duplicating a git repository?
2015-11-14 11:20 Git question. Is there a way of duplicating a git repository? Alan Mackenzie
` (3 preceding siblings ...)
2015-11-14 17:27 ` Ivan Shmakov
@ 2015-11-14 17:37 ` David Reitter
2015-11-14 17:57 ` chris.nixon
` (7 subsequent siblings)
12 siblings, 0 replies; 19+ messages in thread
From: David Reitter @ 2015-11-14 17:37 UTC (permalink / raw)
To: Alan Mackenzie; +Cc: emacs-devel
On Nov 14, 2015, at 6:20 AM, Alan Mackenzie <acm@muc.de> wrote:
> Now that we've cut the emacs-25 release branch, I'd like to have a
> distinct repository for this.
> I could simply download another copy from savannah, but this would
> (presumably) be a distinct copy, rather than hard linking the repository
> files. This would cost me disk (and backup) space.
>
> Or I could clone my master repository to make emacs-25. But this would
> make the new repo firmly subordinate to the master repo, rather than
> directly with savannah.
How would it be subordinate?
A full clone is just that: a deep copy, with no dependency implied. You can push and pull entirely independently. It’s the same as downloading another copy.
Indeed, that’s what I would call “distinct”.
> So, is there any convenient way of duplicating a repo (using hard links,
> and preserving config info)?
If you are looking for a distinct working directory, but not a distinct repository, “git new-workdir” is what you want. The actual repository is locally shared, but you can have a second (and third) working directory, which typically will hold another branch.
It’s not what I would call “distinct repository”, but it’s a distinct directory hard-linked against the original repository.
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: Git question. Is there a way of duplicating a git repository?
2015-11-14 11:20 Git question. Is there a way of duplicating a git repository? Alan Mackenzie
` (4 preceding siblings ...)
2015-11-14 17:37 ` David Reitter
@ 2015-11-14 17:57 ` chris.nixon
2015-11-14 18:17 ` John Wiegley
` (6 subsequent siblings)
12 siblings, 0 replies; 19+ messages in thread
From: chris.nixon @ 2015-11-14 17:57 UTC (permalink / raw)
To: Alan Mackenzie; +Cc: emacs-devel
[-- Attachment #1: Type: text/plain, Size: 985 bytes --]
Assuming you havn't done anything fancy with your clone and that
you have a recent version of git (at least 2.5) you can use
git worktree add -b emacs-25 ../emacs-25 origin/emacs-25
From the root of the current clone to create a new worktree at
../emacs-25 that shares the current repository's .git repo.
Chris
Alan Mackenzie writes:
> Hello, Emacs.
>
> Now that we've cut the emacs-25 release branch, I'd like to have a
> distinct repository for this.
>
> I could simply download another copy from savannah, but this would
> (presumably) be a distinct copy, rather than hard linking the repository
> files. This would cost me disk (and backup) space.
>
> Or I could clone my master repository to make emacs-25. But this would
> make the new repo firmly subordinate to the master repo, rather than
> directly with savannah.
>
> So, is there any convenient way of duplicating a repo (using hard links,
> and preserving config info)?
--
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 472 bytes --]
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: Git question. Is there a way of duplicating a git repository?
2015-11-14 11:20 Git question. Is there a way of duplicating a git repository? Alan Mackenzie
` (5 preceding siblings ...)
2015-11-14 17:57 ` chris.nixon
@ 2015-11-14 18:17 ` John Wiegley
2015-11-14 21:35 ` Alan Mackenzie
2015-11-14 19:21 ` Andreas Schwab
` (5 subsequent siblings)
12 siblings, 1 reply; 19+ messages in thread
From: John Wiegley @ 2015-11-14 18:17 UTC (permalink / raw)
To: Alan Mackenzie; +Cc: emacs-devel
>>>>> Alan Mackenzie <acm@muc.de> writes:
> So, is there any convenient way of duplicating a repo (using hard links, and
> preserving config info)?
A clone on the same device uses hard-links by default.
A --shared clone uses a symbolic link, so works across devices. However,
changes to the original repository affect it as well.
"git worktree add" lets you create a new working tree directly associated with
a single repository, using neither hardlinks nor symlinks; but has the added
overhead of having to learn the "git worktree" set of commands.
John
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: Git question. Is there a way of duplicating a git repository?
2015-11-14 18:17 ` John Wiegley
@ 2015-11-14 21:35 ` Alan Mackenzie
2015-11-16 8:42 ` David Kastrup
2015-11-17 11:54 ` Stephen Leake
0 siblings, 2 replies; 19+ messages in thread
From: Alan Mackenzie @ 2015-11-14 21:35 UTC (permalink / raw)
To: emacs-devel
Hello, John.
On Sat, Nov 14, 2015 at 10:17:33AM -0800, John Wiegley wrote:
> >>>>> Alan Mackenzie <acm@muc.de> writes:
> > So, is there any convenient way of duplicating a repo (using hard links, and
> > preserving config info)?
> A clone on the same device uses hard-links by default.
But what git calls a "clone" is not a duplicate repo. It is radically
different from the original. In particular, the new repo's "remote
origin" is set to the original repo; I want it to duplicate what the
original repo had set.
> A --shared clone uses a symbolic link, so works across devices. However,
> changes to the original repository affect it as well.
This isn't what I want.
> "git worktree add" lets you create a new working tree directly associated with
> a single repository, using neither hardlinks nor symlinks; but has the added
> overhead of having to learn the "git worktree" set of commands.
That wasn't what I asked about either. Maybe it might do, though it is
bound to have drawbacks.
What I want is a command (or a ready recipe) to do for git repositories
what `fork' does for processes (but sharing the maximum possible from
the original repository with hard links). After writing my opening post
I even tried a `git clone --mirror', but the resulting repository wasn't
a mirror of the original at all.
> John
--
Alan Mackenzie (Nuremberg, Germany).
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: Git question. Is there a way of duplicating a git repository?
2015-11-14 21:35 ` Alan Mackenzie
@ 2015-11-16 8:42 ` David Kastrup
2015-11-17 11:54 ` Stephen Leake
1 sibling, 0 replies; 19+ messages in thread
From: David Kastrup @ 2015-11-16 8:42 UTC (permalink / raw)
To: Alan Mackenzie; +Cc: emacs-devel
Alan Mackenzie <acm@muc.de> writes:
> Hello, John.
>
> On Sat, Nov 14, 2015 at 10:17:33AM -0800, John Wiegley wrote:
>> >>>>> Alan Mackenzie <acm@muc.de> writes:
>
>> > So, is there any convenient way of duplicating a repo (using hard links, and
>> > preserving config info)?
>
>> A clone on the same device uses hard-links by default.
>
> But what git calls a "clone" is not a duplicate repo. It is radically
> different from the original. In particular, the new repo's "remote
> origin" is set to the original repo; I want it to duplicate what the
> original repo had set.
git clone --mirror
Curiously, this implies --bare but you can just edit the config file
afterwards and remove the `bare' setting.
--
David Kastrup
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: Git question. Is there a way of duplicating a git repository?
2015-11-14 21:35 ` Alan Mackenzie
2015-11-16 8:42 ` David Kastrup
@ 2015-11-17 11:54 ` Stephen Leake
1 sibling, 0 replies; 19+ messages in thread
From: Stephen Leake @ 2015-11-17 11:54 UTC (permalink / raw)
To: Alan Mackenzie; +Cc: emacs-devel
Alan Mackenzie <acm@muc.de> writes:
> What I want is a command (or a ready recipe) to do for git repositories
> what `fork' does for processes (but sharing the maximum possible from
> the original repository with hard links). After writing my opening post
> I even tried a `git clone --mirror', but the resulting repository wasn't
> a mirror of the original at all.
I think "git worktree add" is what you are looking for. It requires git
2.5 or later.
--
-- Stephe
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: Git question. Is there a way of duplicating a git repository?
2015-11-14 11:20 Git question. Is there a way of duplicating a git repository? Alan Mackenzie
` (6 preceding siblings ...)
2015-11-14 18:17 ` John Wiegley
@ 2015-11-14 19:21 ` Andreas Schwab
2015-11-14 20:02 ` Andy Moreton
` (4 subsequent siblings)
12 siblings, 0 replies; 19+ messages in thread
From: Andreas Schwab @ 2015-11-14 19:21 UTC (permalink / raw)
To: Alan Mackenzie; +Cc: emacs-devel
Alan Mackenzie <acm@muc.de> writes:
> So, is there any convenient way of duplicating a repo (using hard links,
> and preserving config info)?
git worktree add
(git 2.5 or later)
Andreas.
--
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: Git question. Is there a way of duplicating a git repository?
2015-11-14 11:20 Git question. Is there a way of duplicating a git repository? Alan Mackenzie
` (7 preceding siblings ...)
2015-11-14 19:21 ` Andreas Schwab
@ 2015-11-14 20:02 ` Andy Moreton
2015-11-14 21:02 ` Ken Brown
` (3 subsequent siblings)
12 siblings, 0 replies; 19+ messages in thread
From: Andy Moreton @ 2015-11-14 20:02 UTC (permalink / raw)
To: emacs-devel
On Sat 14 Nov 2015, Alan Mackenzie wrote:
> Hello, Emacs.
>
> Now that we've cut the emacs-25 release branch, I'd like to have a
> distinct repository for this.
>
> I could simply download another copy from savannah, but this would
> (presumably) be a distinct copy, rather than hard linking the repository
> files. This would cost me disk (and backup) space.
>
> Or I could clone my master repository to make emacs-25. But this would
> make the new repo firmly subordinate to the master repo, rather than
> directly with savannah.
>
> So, is there any convenient way of duplicating a repo (using hard links,
> and preserving config info)?
Something like this should do what you want:
cd master/..
git clone --reference master git://git.sv.gnu.org/emacs --branch emacs-25 emacs-25
I'm sure someone more expert with git will report a better recipe.
AndyM
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: Git question. Is there a way of duplicating a git repository?
2015-11-14 11:20 Git question. Is there a way of duplicating a git repository? Alan Mackenzie
` (8 preceding siblings ...)
2015-11-14 20:02 ` Andy Moreton
@ 2015-11-14 21:02 ` Ken Brown
2015-11-15 10:33 ` Alan Mackenzie
2015-11-15 2:46 ` Mike Gerwitz
` (2 subsequent siblings)
12 siblings, 1 reply; 19+ messages in thread
From: Ken Brown @ 2015-11-14 21:02 UTC (permalink / raw)
To: Alan Mackenzie, emacs-devel
On 11/14/2015 6:20 AM, Alan Mackenzie wrote:
> Hello, Emacs.
>
> Now that we've cut the emacs-25 release branch, I'd like to have a
> distinct repository for this.
>
> I could simply download another copy from savannah, but this would
> (presumably) be a distinct copy, rather than hard linking the repository
> files. This would cost me disk (and backup) space.
>
> Or I could clone my master repository to make emacs-25. But this would
> make the new repo firmly subordinate to the master repo, rather than
> directly with savannah.
You can fix that by issuing the following command in the new repo:
git remote set-url origin <userid>@git.sv.gnu.org:/srv/git/emacs.git master
After doing that, you'll to do 'git pull' in order to bring in the remote branches, and then you can do 'git checkout emacs-25'.
Ken
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: Git question. Is there a way of duplicating a git repository?
2015-11-14 21:02 ` Ken Brown
@ 2015-11-15 10:33 ` Alan Mackenzie
0 siblings, 0 replies; 19+ messages in thread
From: Alan Mackenzie @ 2015-11-15 10:33 UTC (permalink / raw)
To: Ken Brown; +Cc: emacs-devel
Hello, Ken.
On Sat, Nov 14, 2015 at 04:02:27PM -0500, Ken Brown wrote:
> On 11/14/2015 6:20 AM, Alan Mackenzie wrote:
> > Hello, Emacs.
> > Now that we've cut the emacs-25 release branch, I'd like to have a
> > distinct repository for this.
> > I could simply download another copy from savannah, but this would
> > (presumably) be a distinct copy, rather than hard linking the repository
> > files. This would cost me disk (and backup) space.
> > Or I could clone my master repository to make emacs-25. But this would
> > make the new repo firmly subordinate to the master repo, rather than
> > directly with savannah.
> You can fix that by issuing the following command in the new repo:
> git remote set-url origin <userid>@git.sv.gnu.org:/srv/git/emacs.git master
> After doing that, you'll to do 'git pull' in order to bring in the remote branches, and then you can do 'git checkout emacs-25'.
First of all, many thanks for actually addressing the question I asked.
;-)
What I did in the end was to clone a new repo with the --mirror argument
(so as to copy all the branches, rather than creating new ones pointing
at the original repo), and manually edited .../.git/config so as to get
working directories. Then I changed the remote origin url in that file
by hand.
Having done "git checkout", I was then able to "git pull" from savannah,
and switch to branch emacs-25 with another "git checkout".
So, I'm where I want to be!
Thanks again.
> Ken
--
Alan Mackenzie (Nuremberg, Germany).
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: Git question. Is there a way of duplicating a git repository?
2015-11-14 11:20 Git question. Is there a way of duplicating a git repository? Alan Mackenzie
` (9 preceding siblings ...)
2015-11-14 21:02 ` Ken Brown
@ 2015-11-15 2:46 ` Mike Gerwitz
2015-11-15 7:58 ` Paul Eggert
2015-11-15 10:02 ` Steinar Bang
12 siblings, 0 replies; 19+ messages in thread
From: Mike Gerwitz @ 2015-11-15 2:46 UTC (permalink / raw)
To: Alan Mackenzie; +Cc: emacs-devel
[-- Attachment #1: Type: text/plain, Size: 679 bytes --]
On Sat, Nov 14, 2015 at 11:20:27 +0000, Alan Mackenzie wrote:
> So, is there any convenient way of duplicating a repo (using hard links,
> and preserving config info)?
Each branch has its own tracking branch (upstream). So you can just
branch off of emacs-25, and either keep that local copy, or set the
upstream to your own remote repository:
$ git checkout emacs-25
$ git checkout -b foo
$ git remote add my-origin path/to/remote/repo
$ git push --set-upstream my-origin foo
This is as close to a hard-copy as you'll get.
--
MIKE Gerwitz
Free Software Hacker | GNU Maintainer
http://mikegerwitz.com
FSF Member #5804 | GPG Key ID: 0x8EE30EAB
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 818 bytes --]
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: Git question. Is there a way of duplicating a git repository?
2015-11-14 11:20 Git question. Is there a way of duplicating a git repository? Alan Mackenzie
` (10 preceding siblings ...)
2015-11-15 2:46 ` Mike Gerwitz
@ 2015-11-15 7:58 ` Paul Eggert
2015-11-15 10:02 ` Steinar Bang
12 siblings, 0 replies; 19+ messages in thread
From: Paul Eggert @ 2015-11-15 7:58 UTC (permalink / raw)
To: emacs-devel
Alan Mackenzie wrote:
> is there any convenient way of duplicating a repo (using hard links,
> and preserving config info)?
Not sure what you mean by "preserving config info", but if your current
repository is in a directory named 'master', you could do something like this:
git clone master emacs-25
cd emacs-25
git remote add savannah YOURNAME@git.sv.gnu.org:/srv/git/emacs.git
git fetch savannah
git branch --track emacs-25 savannah/emacs-25
git checkout emacs-25
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: Git question. Is there a way of duplicating a git repository?
2015-11-14 11:20 Git question. Is there a way of duplicating a git repository? Alan Mackenzie
` (11 preceding siblings ...)
2015-11-15 7:58 ` Paul Eggert
@ 2015-11-15 10:02 ` Steinar Bang
12 siblings, 0 replies; 19+ messages in thread
From: Steinar Bang @ 2015-11-15 10:02 UTC (permalink / raw)
To: emacs-devel
>>>>> Alan Mackenzie <acm@muc.de>:
> Now that we've cut the emacs-25 release branch, I'd like to have a
> distinct repository for this.
cd ..
cp -a emacs emacs-25
cd emacs-25
git pull
git checkout -b emacs-25
^ permalink raw reply [flat|nested] 19+ messages in thread