read the transcript!
- Check out the correct branch
git checkout correct-branch
cherry-pick makes a new commit with the same changes as *, but a different parent
- Add the commit you wanted to it
git cherry-pick COMMIT_ID
↑ use ‘
git log wrong-branch’ to find this
- Delete the commit from the wrong branch.
git checkout wrong-branch git reset --hard HEAD^be careful when running ‘
git reset --hard!’ always run ‘
git status’ first to make sure there aren’t uncommitted changes and ‘
git stash’ to save them if there are
© Julia Evans 2021 | All rights reserved (see the FAQ for notes about licensing)