Skip to contentSkip to conversation

patches between different repositories

DISCUSSION Matthias Lehmann 2 participants 2 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

Hi all,

I have to apply patches from one repository to another repository, which have a different layout (I am working on splitting one big repository into several smaller ones, while development still continues on the big repository).

So I did

big-repo$ git format-patche -o /tmp/foo @{some-date} -- subdir small-repo$ git apply -p2 --directory=some/path --check /tmp/foo/*

and get

fatal: git diff header lacks filename information when removing 2 leading pathname components (line 37)

the patch looks like this:

35| diff --git a/xyz/bar.jpg b/xyz/bar.jpg
36| new file mode 100644
37| index 0000000000000000000000000000000000000000.. 

3dcce2e1f68586ed2089d86b1bf4e7e41c818d97
38| GIT binary patch
39| literal 8791

It seems, like the -p options to git-apply can't handle new files.

Am I doing something wrong here? Or is there another way to merge changes within different repositories with differnt layouts?

Any help would be greatly appreciated.

Best regards,

Matthias

#1 lore raw
Quoted 4 lines · Matthias Lehmann

Am I doing something wrong here? Or is there another way to merge changes within different repositories with differnt layouts?

Any help would be greatly appreciated.

Try sub-tree merge after the initial setup you will get another repository as a subdirectory after that you can commit moving files around to match different layout. After that you can just pull & merge and everything will just work =)

Read $ git help merge