I
I
ivandao2021-04-26 12:32:20
git
ivandao, 2021-04-26 12:32:20

How to revert changes to only one file for several commits?

How to roll back changes in only one file for several commits in PHPStrom ? Or tell me please. terminal command.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Kuznetsov, 2021-04-27
@ivandao

We write in the terminal
git checkout хеш_коммита -- полное_имя_файла
and the state of the file will return to what it was after the commit with the specified hash.
But it is more convenient to call the history of this file, select the necessary commit, show the difference between versions and roll back unnecessary changes. And you can leave something.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question