in Technology by
How can we reset or revert a file to a specific revision?

1 Answer

0 votes
by

If you want to revert to the commit before c5f567, append ~1 (where 1 is the number of commits you want to go back, it can be anything):

git checkout c5f567~1 -- file1/to/restore file2/to/restore

As a side note, I've always been uncomfortable with this command because it's used for both ordinary things (changing between branches) and unusual, destructive things (discarding changes in the working directory).

Related questions

0 votes
    I have made some changes to a file that has been committed a few times as part of a group of files, but ... former state in the past Select the correct answer from above options...
asked Jan 31, 2022 in Education by JackTerrance
0 votes
    Which of the following is a revision control system? (a) Git (b) NumPy (c) Slidify (d) None ... questions and answers pdf, Data Science interview questions for beginners...
asked Oct 29, 2021 in Education by JackTerrance
0 votes
    How can we clone a Git repository into a specific folder?...
asked Jan 8, 2021 in Technology by JackTerrance
0 votes
    How can we determine whether a file is successfully opened or not using fopen() function in C?...
asked Nov 9, 2020 in Technology by JackTerrance
0 votes
    How can we identify whether a compilation unit is class or interface from a .class file? (a) Java ... programming questions and answers pdf, java interview questions for beginners...
asked Oct 26, 2021 in Education by JackTerrance
0 votes
    How can a job configuration be reset to an earlier version/state?...
asked Sep 14, 2021 in Technology by JackTerrance
0 votes
    How can a job configuration be reset to an earlier version/state?...
asked Jul 17, 2021 in Technology by JackTerrance
0 votes
    How to revert a Git repository to a previous commit?...
asked Jan 7, 2021 in Technology by JackTerrance
0 votes
    In Git how do you revert a commit that has already been pushed and made public?...
asked Nov 2, 2020 in Technology by JackTerrance
0 votes
    How do I revert from my current state to a snapshot made on a certain commit? If I do git log, then I get ... , i.e. commit 0d1d7fc? Select the correct answer from above options...
asked Jan 30, 2022 in Education by JackTerrance
0 votes
    Define the use of Revert in SVN?...
asked Feb 21, 2021 in Technology by JackTerrance
0 votes
    In Subversion, what exactly is the function performed by the “Revert”?...
asked Feb 18, 2021 in Technology by JackTerrance
0 votes
    Is there a way to revert a git commit that’s already been pushed and made public?...
asked Nov 4, 2020 in Technology by JackTerrance
0 votes
    I use a byte to store some flag like 10101010, and I would like to know how to verify that a ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 16, 2022 in Education by JackTerrance
...