How do I backport a commit in git?

前端 未结 5 1990
说谎
说谎 2020-12-08 03:54

So, I have a maintenance branch and a master branch in my project. If I make a commit in the maintenance branch and want to merge it forward to the master branch, that\'s ea

5条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-08 04:53

    As a general rule, I use merge to move changes "up" the tree (from maintenance to master) and rebase to move them "down" the tree (from master to maintenance). This is so the order of commits in the master branch is maintained.

    Rebase essentially rolls back all your changes on the current branch to the fork (or last rebase), copies over newer changes and then re-applies your changes.

    If you don't want to get all changes from the master, then you will probably need to cherry pick the ones you want.

提交回复
热议问题