Move recent commit(s) to main to a new branch
I sometimes forget to create a new branch before committing a new feature and end up committing to `main`. Probably a leak in my Git best practices but that's an issue for another day.
Here's how I move the commit(s) to a newly created branch:
git branch new-feature git reset --hard HEAD~(number of last commits to move) git checkout new-feature
Credits to Duc Filan on Stackoverflow