I just made a perfectly good commit to the wrong branch. How do I undo the last commit in my master branch and then take those same changes and get them into my upgrade bran
So if your scenario is that you've committed to master
but meant to commit to another-branch
(which may or not may not already exist) but you haven't pushed yet, this is pretty easy to fix.
// if your branch doesn't exist, then add the -b argument
git checkout -b another-branch
git branch --force master origin/master
Now all your commits to master
will be on another-branch
.
Sourced with love from: http://haacked.com/archive/2015/06/29/git-migrate/