threads / discuss / 23682

patches between different repositories

Subject: patches between different repositories

## tl;dr

2 messages between May 3, 2010 and May 3, 2010.

replies: 1people: 2as markdown or json

Matthias Lehmann· May 3, 2010, 17:47 UTC · lore
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
Dmitrijs Ledkovs· May 3, 2010, 18:04 UTC · re: Matthias Lehmann · lore

Re: patches between different repositories

On 3 May 2010 18:47, Matthias Lehmann <mat@matlehmann.de> wrote:
> 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

← back to recent threads