Using git, is there a command which I can reset a file to a specific commit in the commit log?
I know git checkout file can let me reset the file to HEAD, but how to reset to a specific commit version?
Mind your terminology. With git "reset" refers to setting a ref (e.g. branch) to a new commit. You want to put a file from some commit into your working copy. Exactly this is a "checkout".
You can checkout all files of a commit with
git checkout commit
or only part of the commit with
git checkout commit file
If you only want to "show" a file of some commit without changing your working copy you can also use
git show commit:file
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With