Skip to content

How should I move commits up and down multiple times? #4001

Answered by stefanhaller
Latrolage asked this question in Q&A
Discussion options

You must be logged in to vote

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 hold ctrl-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…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by Latrolage
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants