How can I modify the file path in a set of Git patches?

前端 未结 3 1499
日久生厌
日久生厌 2020-12-30 05:09

I\'m working on a Git repo that\'s been pulled from an SVN repo using git svn. Many moons ago, the SVN repo was created from a source tarball of the original (u

3条回答
  •  南笙
    南笙 (楼主)
    2020-12-30 05:38

    I recently had a similar problem. My solution was to create a new target repository with a src subdirectory, then I created a set of patches in the source repository:

    /data/source-repository$ git format-patch -k --root
    

    then those patches were applied to the src directory in the target repository:

    /data/target-repository$ git am -k --committer-date-is-author-date --directory src ../source-repository/*.patch
    

    All patches from the source repository ended in src in the target repository, i.e. all paths were tweaked accordingly.

    From there you could again create patches and import those into the upstream repository inside of a branch.

提交回复
热议问题