To revert a committed file to an earlier version using Git, you can use the git checkout
command. Here's how you can do it:
git checkout {{commit_hash}} -- {{file_path}}
Replace {{commit_hash}}
with the hash of the commit you want to revert to, and {{file_path}}
with the path to the file you want to revert.
For example, if you want to revert the file script.js
to an earlier version with the commit hash abc123
, you would run: