Using GIT, how can I selectively merge changes from one commit on another 'fork'?

后端 未结 4 1160
傲寒
傲寒 2020-12-07 08:08

Take this scenario:

  1. I decide to \'fork\' a codebase on github.com, and start doing my routine: Edit - Commit - Push; aka hack hack hack.
  2. After I made
4条回答
  •  误落风尘
    2020-12-07 08:15

    If you only want a port of a commit, you’re probably best off by cherry-picking the commit you want and resetting files you don’t want touched.

    git cherry-pick SHA1
    git checkout HEAD file1 file2 ... fileN
    

    Of course, if you have several modified parts in a file and only want to keep some of them you have no choice but to edit the file manually, cutting out their changes.

提交回复
热议问题