Robert
Robert

Reputation: 1794

Rollback a single file in git on a remote repository

Another developer and I are sharing a repository. The problem is that he's using VS2005 and I'm using VS2013 so to prevent my updates from screwing up his environment, I've made it a point not to commit csproj/sln files. Unfortunately, in my most recent commit/sync, I accidentally pushed the csproj file. There are two versions now: the original commit one and the current one. Is there a way to roll it back to the original commit version without impacting other files?

Upvotes: 1

Views: 173

Answers (1)

mamapitufo
mamapitufo

Reputation: 4810

You can checkout the desired version of the file with:

git checkout <commit-id> -- path/to/file

Then commit the changes.

Upvotes: 5

Related Questions