How can I selectively merge or pick changes from another branch in Git?

前端 未结 25 1617
慢半拍i
慢半拍i 2020-11-22 02:53

I\'m using Git on a new project that has two parallel -- but currently experimental -- development branches:

  • master: import of existing codebase pl
25条回答
  •  旧时难觅i
    2020-11-22 03:21

    Here is how you can replace Myclass.java file in master branch with Myclass.java in feature1 branch. It will work even if Myclass.java doesn't exist on master.

    git checkout master
    git checkout feature1 Myclass.java
    

    Note this will overwrite - not merge - and ignore local changes in the master branch rather.

提交回复
热议问题