1

I'm trying to merge a subfolder of master branch of repository2 into master branch of repository1, using the steps in this answer by @VonC - How do I merge a sub directory in git?

I perform the first two steps with success (adding the repository2 remote, within the master branch of repository1, then performing an 'empty' merge from repository2 to repository1). The structure of my repositories is like this:

repository2/master
  DataLib
    MessagingLib.V2
       .... files I want to merge into my repository1 branch

repository1/master
  MessagingLib
       .... files I want to merge the repository2 changes into

I have repository1 master branch checked out. So for the git read-tree, I use this command:

git read-tree --prefix=MessagingLib.V2/ -u repository2/master:repository1/MessagingLib

But I get the error

fatal: Not a valid object name repository2/master:repository1/MessagingLib

What's the read-tree command I need?

Update

These don't work either:

git read-tree --prefix=DataLib/MessagingLib.V2/ -u repository2/master:repository1/MessagingLib

git read-tree --prefix=DataLib/MessagingLib.V2/ -u repository2/master:repository1/master

Chris Halcrow
  • 28,994
  • 18
  • 176
  • 206

1 Answers1

1

This was complicated by the fact that I was attempting to merge the subfolder from repository2 into a subfolder of a different name in repository1. I renamed my subfolder in repository1 to MessagingLib.V2 (to match the name on repository2), then I could use:

git read-tree --prefix=MessagingLib.V2/ -u repository2/master:DataLib/MessagingLib.V2

Chris Halcrow
  • 28,994
  • 18
  • 176
  • 206