3 ms·
The "committed to wrong branch" case is also a little overly complex. I'd just do: git checkout correct-branch git cherry-pick wrong-branch git che
by NickHolt 10y ago
The "committed to wrong branch" case is also a little overly complex. I'd just do:
git checkout correct-branch
git cherry-pick wrong-branch
git checkout wrong-branch
git reset --hard HEAD~
- Dru89 10y agoThis is less safe than the branching alternatives. Instead of "moving" the original commit, this copies the original commit to a new one and leaves the original one dangling and waiting to be garbage collected. Also, if you have more than one commit before you noticed you were on the wrong branch, this only grabs the one commit.