tags:

views:

115

answers:

2

I have edits to my working tree which I would like to continue working on in a branch. Will git checkout -b new_branch wipe out my current changes to the working tree? If so, how do I create a new branch and switch to it without reverting my working tree?

+10  A: 

Just do git checkout -b new_branch. It will create the new branch with the changes in your working tree untouched.

1800 INFORMATION
git is very careful to never lose your changes (well, those that you can get back from it)
Jakub Narębski
+5  A: 

If in the future you need to see whether Git would destroy something you haven’t committed yet (which it generally will never do), use git stash to stow away your changes. It will not save files that Git does not know about but Git will also refuse to overwrite unknown files in case of checkouts and similar operations.

Bombe