On Mon, May 25, 2015 at 5:30 PM, Konstantin Khomoutov
> On Sat, 23 May 2015 23:02:46 +0530
> Kalpa Welivitigoda <callka...@gmail.com> wrote:
>> >> Use the `git subtree` command [*].
>> > [...]
>> > To elaborate, a pseudocode (assuming a POSIX shell) is something
>> > like this:
>> > $ cd repoB
>> > $ git tag Bdir12 $(git subtree split dir1-2)
>> > $ cd ../repoA
>> > $ git fetch ../repoB Bdir12
>> > $ git merge -s ours --no-commit Bdir12
>> > $ git read-tree --prefix dir1/dir1-2 -u Bdir12
>> > $ git commit --edit
>> Thanks for all the support rendered. I tried the above method and it
>> places the directory from repoB to the correct place on repoA. But if
>> I log the commits for dir1-2 in repoA (git log dir1/dir1-2), it shows
>> only the merging of the tag, not the individual commits for that
>> particular directory. But if I do a git log from root of repoA, it
>> shows all the commits. Is it possible to have the commits for dir1-2 ?
> Given the merge commit, does
> $ git log <that_merge_commit>^2
> show you the proper history line?
yes, it is correctly displayed.
> That "^2" thing selects the second parent of a commit, and in the
> case of a simple merge (two parents) this is the side which has been
> merged into -- that is, the tree extracted by `git subtree split`).
> On the same note, does
> $ git log <that_tag_produced_by_git_subtree>
> give you the history you're expecting to see?
yes, it gives the same output as the above and that is the expected outcome.
> I mean, we have to tell if you have a problem extracting the history
> or the problem properly listing it (or some other problem).
> I'd also recommend running
> $ gitk --all
> $ git log --all --graph --decorate --oneline
> to see a neatly layed of overview of the commit graph in your repo.
> In it, it should be easy to see if your merge commit actually has
> two parents with the second one having a history extracted from the
> source repo attached to it.
I ran gitk --all on repoA and it seems there's only one parent.
Following is the output of $ git log --all --graph --decorate --oneline
* 9c97cd4 (HEAD, master) Merge tag 'tags/Bdir12'
| * af56821 (tag: Bdir12) updating dir1-2
| * d0b8f8a adding dir1-2
* 2f4b0ae adding dir1
* 854521c adding dir1/dir1-3
* 6f54cfb adding dir1/dir1-1
* 2ff6f17 adding dir2
* 0710523 init commit
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
For more options, visit https://groups.google.com/d/optout.