How to merge specific files from Git branches

后端 未结 11 1874
长发绾君心
长发绾君心 2020-11-30 16:23

I have 2 git branches branch1 and branch2 and I want to merge file.py in branch2 into file.py in branch1 and only that file.

In essence I just want to work on the fi

11条回答
  •  感动是毒
    2020-11-30 16:49

    The solution I found that caused me the least headaches:

    git checkout 
    git checkout -b dummy
    git merge 
    git checkout 
    git checkout dummy 
    

    After doing that the file in path to file in b2 is what it would be after a full merge with b1.

提交回复
热议问题