Reputation: 10629
I am a git newbie, I am using git to track simple txt files (R scripts). I don't have branches or all the features git supports, I am just using git to track the changes I do to a couple of text scripts in each project (and thus avoid renaming a file every time I do a change to track changes).
I am in a situation where I would like to open a file exactly how it was on a specific date/commit and save it under another name without changing branch or workspace (stay on master) or reverting/modifying any other files (including this specific file as it is now).
How can I do this?
Update : Is there a way to do this using a GUI (preferably in linux)?
Upvotes: 0
Views: 70
Reputation: 128
command:
git show {commithash}:{path} > {newfilename}
example:
git show 50559d3:conf/routes > routes-back-then.txt
Upvotes: 1
Reputation: 60393
git show @{yesterday}:path/to/file >extract.r
. See git revisions for the @ syntax
Upvotes: 3