mirror of
https://github.com/jbranchaud/til
synced 2026-01-02 22:58:01 +00:00
Add Grab A Single File From A Stash as a git til.
This commit is contained in:
@@ -38,6 +38,7 @@ smart people at [Hashrocket](http://hashrocket.com/).
|
||||
- [Determine The Hash Id For A Blob](git/determine-the-hash-id-for-a-blob.md)
|
||||
- [Dry Runs in Git](git/dry-runs-in-git.md)
|
||||
- [Excluding Files Locally](git/excluding-files-locally.md)
|
||||
- [Grab A Single File From A Stash](git/grab-a-single-file-from-a-stash.md)
|
||||
- [Ignore Changes To A Tracked File](git/ignore-changes-to-a-tracked-file.md)
|
||||
- [Intent To Add](git/intent-to-add.md)
|
||||
- [Last Commit A File Appeared In](git/last-commit-a-file-appeared-in.md)
|
||||
|
||||
17
git/grab-a-single-file-from-a-stash.md
Normal file
17
git/grab-a-single-file-from-a-stash.md
Normal file
@@ -0,0 +1,17 @@
|
||||
# Grab A Single File From A Stash
|
||||
|
||||
In git, you can reference a commit SHA or branch to checkout differing
|
||||
versions of files.
|
||||
|
||||
```bash
|
||||
$ git checkout d3d2e38 -- README.md
|
||||
```
|
||||
|
||||
In the same way, you can snag the version of a file as it existed in a
|
||||
stash. Just reference the relevant stash.
|
||||
|
||||
```bash
|
||||
$ git checkout stash@{1} -- README.md
|
||||
```
|
||||
|
||||
[source](http://stackoverflow.com/questions/1105253/how-would-i-extract-a-single-file-or-changes-to-a-file-from-a-git-stash)
|
||||
Reference in New Issue
Block a user