{"thread":{"id":"12313","subject":"how to apply diff between A and B to a file?","startedAt":"2008-02-25T18:43:26Z","lastAt":"2008-02-25T18:58:03Z","messageCount":2,"participants":["Denis Shaposhnikov","Jakub Narebski"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"69898","messageId":"20080225214326.353d0e95@wizard.volgograd.ru","threadId":"12313","inReplyTo":null,"subject":"how to apply diff between A and B to a file?","fromName":"Denis Shaposhnikov","fromEmail":"dsh@wizard.volgograd.ru","sentAt":"2008-02-25T18:43:26Z","receivedAt":"2008-02-25T18:43:26Z","isPatch":false,"sender":{"key":"dsh@wizard.volgograd.ru","avatar":null},"body":"Hello,\n\nWith svn I used a command \"svn merge -r A:B some/file\" to apply diff\nbetween revisions A and B to file some/file. I done it in one branch,\nin trunk for example. Is it possible to do such thing with git?\n\nThanks!\n\n-- \nDSS5-RIPE DSS-RIPN mailto:dsh@wizard.volgograd.ru xmpp:dsh@vlink.ru\nhttp://wizard.volgograd.ru/ 2:550/5068@fidonet 2:550/5069@fidonet\n"},{"id":"69901","messageId":"m3fxvgc18q.fsf@localhost.localdomain","threadId":"12313","inReplyTo":"20080225214326.353d0e95@wizard.volgograd.ru","subject":"Re: how to apply diff between A and B to a file?","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2008-02-25T18:58:03Z","receivedAt":"2008-02-25T18:58:03Z","isPatch":false,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Denis Shaposhnikov <dsh@wizard.volgograd.ru> writes:\n\n> Hello,\n> \n> With svn I used a command \"svn merge -r A:B some/file\" to apply diff\n> between revisions A and B to file some/file. I done it in one branch,\n> in trunk for example. Is it possible to do such thing with git?\n\nNot using \"git merge\", which is by design whole tree opration in\nGit. It must be, to support rename detection.\n\nYou can, however, do the following:\n\n  $ git diff A B -- some/file | git apply --index\n\n(not tested!).\n-- \nJakub Narebski\nPoland\nShadeHawk on #git\n"}]}