Git: Move Your Latest Commits to Another Branch
Sometimes we start writing code without managing our branches in advance. Then we make commits in master (or some other base branch) when we intended to carve off a new feature branch. In this guide, we'll learn how to move our latest commits to another branch, leaving our original branch unchanged.
If you've never used these tools before, visit our guide on how to commit and push in Git. You may also find our guide on how to check out a remote branch useful.