Can git switch branch without the modification

Posted by hguser on Stack Overflow See other posts from Stack Overflow or by hguser
Published on 2013-11-07T03:50:16Z Indexed on 2013/11/07 3:53 UTC
Read the original article Hit count: 175

Filed under:

I have a project which have completed the basic models(at master), then I commit them.

Then I create two branchs user and product using:

git checkout -b user
git checkout -b product
git checkout user

Then I add the codes in the user branch, but I found that I have to make some changes for the basic models.

Then I switch to master:

git checkout master

But I found that the modification I made in the user branch is visible in the working directory now.

How to avoid this? Since the change to master and modification will be frequency.

© Stack Overflow or respective owner

Related posts about git