I\'d like to move the last several commits I\'ve committed to master to a new branch and take master back to before those commits were made. Unfortunately, my Git-fu is not
1) Create a new branch, which moves all your changes to new_branch.
git checkout -b new_branch
2) Then go back to old branch.
git checkout master
3) Do git rebase
git rebase -i
4) Then the opened editor contains last 3 commit information.
...
pick C
pick D
pick E
...
5) Change pick to drop in all those 3 commits. Then save and close the editor.
...
drop C
drop D
drop E
...
6) Now last 3 commits are removed from current branch (master). Now push the branch forcefully, with + sign before branch name.
git push origin +master