Is it possible to reverse the changes from just one commit file?

Asked

Viewed 175 times

2

Suppose it was made a commit and that a file has been modified erroneously. Is there any way to reverse this commit only for the file you want?

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 revert the file (number of revisions reverted after the ~):

git checkout master~1 nomedoarquivo

For more information, check out reference.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.