I have a local branch with commits like: head/master 5 4 3 2 1
I want to move 3 to the head and not lose any other commits: head/master 3 5 4 2 1 Is this what rebase is for? (Obviously, I'm new)
Ideas? thanks in advance
Use git rebase:
git rebase -i HEAD~5
After HEAD~
there is number five - it is the same as the commits you have. After executing this command, your editor* should run. It has a list of your last 5 commits (remember HEAD~5
?). Now change the position of commit(s) on the list of commits you are presented and save and close the editor. You are done. The position of commits have changed.
*
How do I make Git use the editor of my choice for commits?