I started on a simple task in the main branch. ya’ know the type of task where “this is too simple even to bother with a git branch”… the inevitable result was that now I have a lot of unfinished work in the master branch and need to work on other things. How do I move my current work to a new branch?
Share
You can switch branches with a dirty tree, as long as the switch doesn’t involve modifying dirty files. Since you’re creating a new branch it’s guaranteed not to:
Once you’ve done that you can commit and switch back to master. You can also commit first, although it’s slightly more work, because you need to rollback master to before the commit: