pal4life
pal4life

Reputation: 3378

Does operations on 1 branch alter the other branch as well

I created a 2nd branch on my master git called staging and check it out. This was because i was getting a bunch of untracked files and new files added message. I got rid of them in the new branch using git clean. This also updated my original branch as well which I believed should have been independent of my changes on the other branch. Any clues regarding that.

Upvotes: 0

Views: 39

Answers (1)

cdhowie
cdhowie

Reputation: 169256

Branches only store files you have committed. If you checked out another branch with a dirty working directory, the original branch is not altered to store that state. Using git clean operates on your working directory, and your working directory is a completely independent thing from a branch.

Look at git stash if you want a way to store changes to the working directory without creating a proper commit.

Upvotes: 1

Related Questions