git cherry-pick with target file renamed

前端 未结 2 960
死守一世寂寞
死守一世寂寞 2021-01-17 10:33

I have two branches for different versions - one for current development and another is long-time support several years old. As a consequence they differ significantly. I ha

2条回答
  •  情歌与酒
    2021-01-17 11:19

    Remembered, where I have seen something similar. It was here. Linked script helps as well.

    With the script you might do it with one-liner:

    $ git merge-associate Old/Path/Original.txt :1:New/Path/Renamed.txt :3:New/Path/Renamed.txt
    

    Same as if git merge-file supported :stage:filepath syntax without doing all the fuss around git show :1:New/Path/Renamed.txt > 1.txt; git show :3:New/Path/Renamed.txt > 3.txt described in Git FAQ.

提交回复
热议问题