How should I move commits up and down multiple times? #4001
-
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
If you want to move a commit down over a longer distance, the best way to do that is to highlight the line just below where you want to move it to (already highlighted in your screenshot), press I see that you have a lot of merge commits between the two commits; I'm not totally sure how well this method works in that case, but I think it should still work fine. I personally find rebasing across merge commits confusing, so I try to avoid that in general. A good way to avoid it is to never merge master into feature branches; always rebase the feature branch onto master instead, this results in a much clearer history that's easier to work with. |
Beta Was this translation helpful? Give feedback.
If you want to move a commit down over a longer distance, the best way to do that is to highlight the line just below where you want to move it to (already highlighted in your screenshot), press
e
to start an interactive rebase from there, select the commit(s) you want to move, and press and holdctrl-j
to move it down using auto-repeat. It will not move past the "you are here" commit, so you don't have to pay attention to how far you go. Then continue the rebase, and you'll have to resolve the conflict only once.I see that you have a lot of merge commits between the two commits; I'm not totally sure how well this method works in that case, but I think it should still work fine. I person…