Search code examples
gitatlassian-sourcetree

How to put uncommitted changes on a new branch in SourceTree?


This question and others deal with this problem in Git, but I generally work only in the SourceTree IDE. I've done some work, but before committing it, I realizes it should be on its own branch. How do I do that without losing the work I've done?


Solution

  • It works much the same in SourceTree as in command-line Git: your unstaged, uncommitted changes aren't affected when you create and checkout a new branch.

    So right-click the previous commit in the Log/history, pick "Branch..." and enter a branch name. When you "Create Branch", your unstaged uncommitted work will still be there, and you'll be in the new branch.

    Stage and commit your changes as per normal.