3 ms·
Are you looking to replace the current version of the file (undoing changes to the file back to a past commit) or are you trying to make a new file containing t
by OkayPhysicist 4y ago
Are you looking to replace the current version of the file (undoing changes to the file back to a past commit) or are you trying to make a new file containing the contents of the file at the time of the past commit?
For the former, there's git checkout <branch> -- <filepath>, which has been given it's own command as git restore --source <branch> filename.
For the latter, there's git show <ref>:<filepath>, which you then pipe into the file you want to write, like
git show master:src/main.js > temp_main_old.js
- alcover 4y agoI meant the latter. This is very helpful ! Thx a lot.