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?
views:
115answers:
2
+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
2009-05-26 08:43:34
git is very careful to never lose your changes (well, those that you can get back from it)
Jakub Narębski
2009-05-26 10:56:55
+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
2009-05-26 11:54:29