On Mon, Nov 20, 2017 at 07:47:05PM -0800, Zvi Vered wrote:

> I tried:
> git subtree split --prefix=windows 
> and got:
> adb5b0b26c0793db6cf86ee7647a4a649c2c7a8d
> 
> Then I tried to run : add+commit+push but got:
> nothing to commit, working tree clean
> 
> What should be the next step ? 

Sorry for being maybe a bit harsh but did you read the manual page of
the `git subtree` command?

Let's cite 

| split
|    Extract a new, synthetic project history from the history of the
|     <prefix> subtree. The new history includes only the commits
|    (including merges) that affected <prefix>, and each of those commits
|    now has the contents of <prefix> at the root of the project instead
|    of in a subdirectory. Thus, the newly created history is suitable for
|    export as a separate git repository.
| 
|    After splitting successfully, a single commit id is printed to stdout.
|    This corresponds to the HEAD of the newly created tree, which you can
|    manipulate however you want.

See that last bit?  The command printed out the name of the tip commit of the
history it synthesized, and that's what you can now subtree-merge under
your custom prefix.


Oh, and while we're at it, please keep in mind that even though your
subtree merge will bring that synthetic history under a prefix, the
merged-in history (of that directory) will not have that prefix recorded
in its commits, and that might be confusing.

I mean that if we assume that the `git subtree split` produced a line of
commits

  ...->D->E->F

and your branch you want to subtree-merge that into is currently

  ...->A->B->C

so the merge result will be

  ...->D->E->F--\
                |
                            v
  ...->A->B->C->M

then _at the commit M,_ the contents of F will be located at the prefix
you passed to subtree merge command, but in the commit F itself, and in
all its parent commits, the contents will not be located under that
prefix -- simply because they are two separate lines of history.

It might produce confusing results when using command like

  $ git log -- path/to/the/prefix/used/for/subtree/merge

and seeing it listing no commits past M (because that's the earlies
commit actually recording something at that prefix).

If you want all the commits extracted by `git subtree split` to also
have their contents recorded under a prefix, you'd need to rewrite that
history as I've tried to explain in [1], which is a part of [2].

1. https://groups.google.com/d/msg/git-users/HXoX-kpkYkM/R4IN_3yuB24J
2. https://groups.google.com/d/topic/git-users/HXoX-kpkYkM/discussion

-- 
You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to