0

A week ago I branched from develop and have made modifications to about 5 different files. There's about 5 commits which affect all of them. Is there a git command which will restore just one file to the state it was just after the branch was forked? After debugging and further changes etc I realised one file should have been left alone in the first place..

cardamom
  • 5,099
  • 3
  • 35
  • 77
  • 2
    `git checkout -- `? – Biffen Feb 27 '18 at 11:01
  • That would involve finding that commit, and that file has not been touched for months before I did the branching. Maybe [this](https://stackoverflow.com/questions/307579/how-do-i-copy-a-version-of-a-single-file-from-one-git-branch-to-another) , but there might be an easier way.. – cardamom Feb 27 '18 at 11:03
  • It doesn't have to be a commit where it was changed, just any commit before you changed it. – Biffen Feb 27 '18 at 11:04
  • ...but then finding the last commit where it changed (before your commits) should be easy enough: `git log -- ` – Biffen Feb 27 '18 at 11:06
  • Thanks, I did that and it seems to have worked. All that was really different in the file was some spacing after manually changing it back, but didn't want it to show that the file had been touched. – cardamom Feb 27 '18 at 11:07

0 Answers0