Blankman
Blankman

Reputation: 267170

Why did git keep the files after I changed back to master?

I was working in a branch that I created like:

git checkout -b feature_xyz

After working in that branch, I wanted to throw away all the work so I moved back to master:

git checkout master

When I did that, I saw this:

M app/path/to/file1.rb M app/path/to/file2.rb D app/path/to/file3.rb switched to branch 'master' your branch is up-to-date with origin/master

I then deleted the feature branch:

git branch -d feature_xyz

Now when I do git status I see files that I was modifying in that feauture_xyz branch, how is this possible?

Upvotes: 0

Views: 20

Answers (1)

torek
torek

Reputation: 489173

Git is intended to work like this. Uncommitted changes get carried from branch to branch as you switch, if they can be.

See Git - checkout another branch when there are uncommitted changes on the current branch for more information.

Upvotes: 2

Related Questions