Reordering of commits

前端 未结 5 830
旧巷少年郎
旧巷少年郎 2020-11-28 02:33

I\'m currently working on a branch and want some commits to merge into other branches:

    a-b-c-d-e-f-g (branchA)
   /
--o-x-x-x-x-x-x-x-x-x-x (master)
   \         


        
5条回答
  •  温柔的废话
    2020-11-28 03:16

    git rebase -i HEAD~3
    

    Where 3 is the number of commits that need reordering (source).

    This will open vi, listing commits from oldest (top) to newest (bottom).
    Now reorder the lines, save, and exit the editor.

    ddp will move current line down
    ddkP will move current line up (source)

提交回复
热议问题