AndreDuarte
AndreDuarte

Reputation: 804

Removes all modifications made to a file in GIT

I use a Git server to control my code versions and updates. I've made a lot of changes to some files and did not commit anything. But I wanna clear all modifications made to a single file cause it didn't work as I expected. Example:

Files modificated:

Person.java
Document.java
Address.java
Phone.java

I want to "rollback" modifications made to:

Address.java

There is any way to do it without copying everything from HEAD revision to my current file?

I'm using Git Bash and Eclipse.

Thanks!

Upvotes: 1

Views: 52

Answers (1)

FatalError
FatalError

Reputation: 54551

If I understood your situation right, you should be able to simply checkout the file in question:

git checkout -- Address.java

this will reset the changes only in that file. If you have already staged the file for commit (i.e. used git add) you should reset it first:

git reset Address.java

Upvotes: 3

Related Questions