Here's a preview from my zine, Oh Shit, Git! If you want to see more comics like this, sign up for my saturday comics newsletter or browse more comics!
get the zine!
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