git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* incorporating the past
@ 2007-04-09 18:14 Thomas Hühn
  2007-04-09 18:32 ` Shawn O. Pearce
  2007-04-09 19:59 ` Junio C Hamano
  0 siblings, 2 replies; 3+ messages in thread
From: Thomas Hühn @ 2007-04-09 18:14 UTC (permalink / raw)
  To: git

Hi

I have looked through some git tutorials and the manual, and what is
interesting me most right now is, how do I handle a situation like this
with git? It's purely speculative, I don't have such a situation in
reality, so my description might be a bit murky...

I'll try to make an extremely simple example, just one file, no
branching etc.

I have a file under version control, that I got at the point of file
version 1.0. I start committing changes:

o--o--o--o--o--o--o
^                 ^
git init,         current,
version 1.0       version 1.6

Then I get the history up to my version 1.0 from somewhere else (former
maintainer, whatever). In the form of plain text files, one for each
version; say, versions 0.1 thru 0.9. I want to incorporate this past
into my tree.

Can I just do another git init for 0.1, commit the changes up to 1.0 and
merge those two histories? Don't I need a common ancestor for both or
something like that?

Or can I do the same, only up to 0.9 instead of 1.0, and then "sew
together" those histories?

Is there some kind of "add-past", where the changed contents in the
working directory are prepended, not appended to the history? So that I
could "prepend" 0.9, then 0.8 and so on until 0.1?

I guess, I just don't have a clear grasp of what "history" and "branch"
and so on mean.

Thomas

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: incorporating the past
  2007-04-09 18:14 incorporating the past Thomas Hühn
@ 2007-04-09 18:32 ` Shawn O. Pearce
  2007-04-09 19:59 ` Junio C Hamano
  1 sibling, 0 replies; 3+ messages in thread
From: Shawn O. Pearce @ 2007-04-09 18:32 UTC (permalink / raw)
  To: Thomas Hühn; +Cc: git

Thomas H??hn <newsgroups@thomas-huehn.de> wrote:
> I have a file under version control, that I got at the point of file
> version 1.0. I start committing changes:
> 
> o--o--o--o--o--o--o
> ^                 ^
> git init,         current,
> version 1.0       version 1.6
> 
> Then I get the history up to my version 1.0 from somewhere else (former
> maintainer, whatever). In the form of plain text files, one for each
> version; say, versions 0.1 thru 0.9. I want to incorporate this past
> into my tree.
>
> Or can I do the same, only up to 0.9 instead of 1.0, and then "sew
> together" those histories?

Yes.  Look at the `grafts' file.  You can create a new repository
of the 0.9..1.0 history, then graft that repository as a new parent
of the 1.0 commit.  This lets you join in the old history behind
the existing history.  The Linux kernel folks have done this for
the kernel repository.

-- 
Shawn.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: incorporating the past
  2007-04-09 18:14 incorporating the past Thomas Hühn
  2007-04-09 18:32 ` Shawn O. Pearce
@ 2007-04-09 19:59 ` Junio C Hamano
  1 sibling, 0 replies; 3+ messages in thread
From: Junio C Hamano @ 2007-04-09 19:59 UTC (permalink / raw)
  To: Thomas Hühn; +Cc: git

Thomas Hühn <newsgroups@thomas-huehn.de> writes:

> Can I just do another git init for 0.1, commit the changes up to 1.0 and
> merge those two histories? Don't I need a common ancestor for both or
> something like that?
>
> Or can I do the same, only up to 0.9 instead of 1.0, and then "sew
> together" those histories?

Yes. you can "graft" two distinct histories together.

You already have v1.0..v1.6 history.  You create v0.1..v0.9
history the same way, perhaps in a separate repository.

Then, you tell git to pretend that the v1.0, which in reality
does not have any parent (i.e. "git cat-file commit v1.0" does
not have any "parent" line), has one parent that is v0.9, by
creating a file .git/info/grafts.  The file should list two
commit object names (v1.0 first and then v0.9) separated with a
single SP and then terminated with a single LF.  Each line of
this file says "this commit (the first one on the line) has the
following parents (the rest)".

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2007-04-09 19:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-04-09 18:14 incorporating the past Thomas Hühn
2007-04-09 18:32 ` Shawn O. Pearce
2007-04-09 19:59 ` Junio C Hamano

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).