mirror of
https://github.com/jbranchaud/til
synced 2026-01-03 23:28:02 +00:00
Add Checkout Old Version Of A File as a git til.
This commit is contained in:
@@ -13,6 +13,7 @@ smart people at [Hashrocket](http://hashrocket.com/).
|
||||
|
||||
### git
|
||||
|
||||
- [Checkout Old Version Of A File](git/checkout-old-version-of-a-file.md)
|
||||
- [Checkout Previous Branch](git/checkout-previous-branch.md)
|
||||
- [Delete All Untracked Files](git/delete-all-untracked-files.md)
|
||||
- [Dry Runs in Git](git/dry-runs-in-git.md)
|
||||
|
||||
13
git/checkout-old-version-of-a-file.md
Normal file
13
git/checkout-old-version-of-a-file.md
Normal file
@@ -0,0 +1,13 @@
|
||||
# Checkout Old Version Of A File
|
||||
|
||||
When you want to return to a past version of a file, you can reset to a past
|
||||
commit. When you don't want to abandon a bunch of other changes, this isn't
|
||||
going to cut it. Another option is to just checkout the particular file as
|
||||
it was at the time of a past commit.
|
||||
|
||||
If the sha of that past commit is `72f2675` and the file's name is
|
||||
`some_file.rb`, then just use checkout like so:
|
||||
|
||||
```
|
||||
$ git checkout 72f2675 some_file.rb
|
||||
```
|
||||
Reference in New Issue
Block a user