Alex
Alex

Reputation: 3981

Git - remove unstaged changes to a file that has staged changes

I have a file that has some staged changes I added through git add -p

I would like to discard, or stash, the rest of the changes to that file, without touching the changes that I already added, how do I do this?

Upvotes: 1

Views: 196

Answers (1)

DAXaholic
DAXaholic

Reputation: 35408

A simple checkout of the file should do what you want

git checkout -- $file 

Upvotes: 1

Related Questions