Can I get a patch-compatible output from git-diff?

前端 未结 5 1016
傲寒
傲寒 2020-12-07 07:43

I am doing something very simple wrong. I\'m trying to prepare an ordinary patch file, so I can reapply some changes:

$ git diff > before
$ git diff some         


        
5条回答
  •  盖世英雄少女心
    2020-12-07 08:06

    The git diffs have an extra path segment prepended to the file paths. You can strip the this entry in the path by specifying -p1 with patch, like so:

    patch -p1 < save.patch
    

提交回复
热议问题