Git. Merging changes from one file to another files WITHIN the same branch

后端 未结 1 1918
隐瞒了意图╮
隐瞒了意图╮ 2020-12-16 18:52

I have two files:

    master/newsletter1/file.html 
    master/newsletter2/file.html

newsletter1/file.html has a lot of new changes that I

相关标签:
1条回答
  • 2020-12-16 19:42

    I would recommend using a third-party diff tool of your choice, in order to do a manual merge between the two files.
    This is not about source-control (ie managing the history of versions for one file).
    This is about reporting changes from one files to another (the source-control tool will then pick up the new version for the second file).


    As Jefromi mentions in the comments, and as he explains in "run git merge algorithm on two individual files", git merge-file can actually merge two different files, provided a common ancestor is provided.

    git merge-file <current-version> <common-ancestor> <other-version>
    

    In your case, you could try with the common ancestor being identical to the current file.

    git merge-file master/newsletter2/file.html master/newsletter1/file.html master/newsletter2/file.html
    
    0 讨论(0)
提交回复
热议问题