I am trying to reorder my two last commits.
I have order like
449b581 latest commit 8aa0c5a commit prior to latest commit and I'm got in to rebase using comand
git rebase -i HEAD~2 which leads me to VIM editor with text
pick 8aa0c5a commit prior to latest commit pick 449b581 latest commit # Rebase a716b77..449b581 onto a716b77 # # Commands: # p, pick = use commit # r, reword = use commit, but edit the commit message # e, edit = use commit, but stop for amending # s, squash = use commit, but meld into previous commit # f, fixup = like "squash", but discard this commit's log message # x, exec = run command (the rest of the line) using shell # # These lines can be re-ordered; they are executed from top to bottom. # # If you remove a line here THAT COMMIT WILL BE LOST. # # However, if you remove everything, the rebase will be aborted. # # Note that empty commits are commented out After swithcing commits to
pick 449b581 latest commit pick 8aa0c5a commit prior to latest commit and exiting VIM I get
$ git rebase -i HEAD~2 Successfully rebased and updated refs/heads/master. but my log is still the same. How come? I tried different order of pick commands after seeing the first time didn't go as expected. ;) There is no error, no merge pending or something like that. I had to stash few files before doing reodering the commits. Did it affect the rebasing?
btw, all I want to do is push my last commit to remote repository but I don't want the previous commit goes there too. Am I on the right track or I can achieve this without reordering commits?