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

前端 未结 25 1560
慢半拍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条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-11-22 03:08

    You can use read-tree to read or merge a given remote tree into the current index, for example:

    git remote add foo git@example.com/foo.git
    git fetch foo
    git read-tree --prefix=my-folder/ -u foo/master:trunk/their-folder
    

    To perform the merge, use -m instead.

    See also: How do I merge a sub directory in Git?

提交回复
热议问题