Is it possible to revert changes to only one file in a commit?

2

Let's say we made a commit and that a file was changed wrong. Is there any way to revert this commit to just the file you want?

    
asked by anonymous 05.09.2016 / 15:22

1 answer

5

Yes, there are 2 ways to do this:

1- Specifying the file commit revision number:

git checkout revisao nomedoarquivo

2- Specifying the number of revisions you want to roll back (the number of revisions rolled back after ~):

git checkout master~1 nomedoarquivo

For more information, look at the reference .

    
05.09.2016 / 15:56