Will create a git branch, delete my local changes

Possible duplicate:
Git - create a branch with current changes

I did a lot of work on my project, which, as I understand it, should have been done in another branch. If I now create a branch, will the current changes be checked or will they be erased when a new branch is created? I am new to GIT and just trying to avoid the beginners mistake.

+5
source share
3 answers

If you create a new branch from the current HEAD using:

$ git checkout -b newbranchname

Then the changes will NOT be overwritten.

+7
source

In your case, the bdonlan response is used, since creating a new branch does not concern the working directory.

, , Git , , . , .

, , Git stash:

git stash save

, :

git checkout -b new-branch-name

Git stash:

git stash pop
+2

They will be moved to a new branch. But if you feel unsafe, you can always take a backup of your local project directory.

+1
source

All Articles