I have a file where:
The previous version of the file, with commit (ABC
for example) is correct
however the current (working file), compared to the previous version (using gitlens on vs code), lost many changes that I want to keep.
The problem is that I want to find & revert the commit that made the wrong changes (the one that affected the working file) but the last commit I can see for the working file is (commit ABC
, which is the correct version)
Notes:
My git status: nothing to commit, working tree clean
I found the last commits for the file mentioned using:
git log --follow -- full_path_to_file
which show commit ABC
(where the file is in the correct state)
master branch
into this feature branch
that I am working on) that was handled incorrectly, where someone took the the old version of the files instead of taking the updated versionThe problem here that led to this, was running git log --follow -- full_path_to_file
By running instead git log full_path_to_file
( instead of the above), it has shown the commit that resulted in the file (which has the incorrect/undesired state)
By checking that merge, it was merging two changes (which both didn't have the new changes that I am missing, causing that issue)