Punisher
Punisher

Reputation: 684

Git branches is not independent from master

I create a branch from my master. However, when I checkout into the branch and make changes, these changes appear in my master branch when I checkout back to master. Another very weird thing is that git does not force me to commit when I make changes and do checkout. How can I have a branch that is independent from the master?

I have created many branches before, but I have never run into this problem before.

Upvotes: 0

Views: 396

Answers (1)

eftshift0
eftshift0

Reputation: 30164

As long as you don't commit the changes, they will come with you to other branches that you checkout (either on the working tree or on index if you have already added something there).

Now, this question, I don't understand what you mean: How can I have a branch that is independent from the master? Just in case, you can have a branch that is completely independent of master by creating an orphan branch.... but I'm not sure that is what you are asking about.

Upvotes: 1

Related Questions