diff --git a/README.md b/README.md index 0936ad2..9a4d53d 100644 --- a/README.md +++ b/README.md @@ -43,6 +43,7 @@ * [Apply any stash without deleting from the stashed list](https://github.com/git-tips/tips#apply-any-stash-without-deleting-from-the-stashed-list) * [Apply last stashed state and delete it from stashed list](https://github.com/git-tips/tips#apply-last-stashed-state-and-delete-it-from-stashed-list) * [Delete all stored stashes](https://github.com/git-tips/tips#delete-all-stored-stashes) +* [Grab a single file from a stash](https://github.com/git-tips/tips#grab-a-single-file-from-a-stash) * [Show all tracked files](https://github.com/git-tips/tips#show-all-tracked-files) * [Show all untracked files](https://github.com/git-tips/tips#show-all-untracked-files) * [Show all ignored files](https://github.com/git-tips/tips#show-all-ignored-files) @@ -75,6 +76,7 @@ * [Undo assume-unchanged.](https://github.com/git-tips/tips#undo-assume-unchanged) * [Clean the files from `.gitignore`.](https://github.com/git-tips/tips#clean-the-files-from-gitignore) * [Restore deleted file.](https://github.com/git-tips/tips#restore-deleted-file) +* [Restore file to a specific commit-hash](https://github.com/git-tips/tips#restore-file-to-a-specific-commit-hash) * [Always rebase instead of merge on pull.](https://github.com/git-tips/tips#always-rebase-instead-of-merge-on-pull) * [List all the alias and configs.](https://github.com/git-tips/tips#list-all-the-alias-and-configs) * [Make git case sensitive.](https://github.com/git-tips/tips#make-git-case-sensitive) @@ -331,6 +333,17 @@ __Alternatives:__ git stash drop ``` +## Grab a single file from a stash +```sh +git checkout -- +``` + + +__Alternatives:__ +```sh +git checkout stash@{0} -- +``` + ## Show all tracked files ```sh git ls-files -t @@ -527,6 +540,11 @@ git clean -X -f git checkout ^ -- ``` +## Restore file to a specific commit-hash +```sh +git checkout -- +``` + ## Always rebase instead of merge on pull. ```sh git config --global branch.autosetuprebase always diff --git a/tips.json b/tips.json index 45f147a..ff48dad 100644 --- a/tips.json +++ b/tips.json @@ -125,6 +125,10 @@ "title": "Delete all stored stashes", "tip": "git stash clear", "alternatives": ["git stash drop "] +}, { + "title": "Grab a single file from a stash", + "tip": "git checkout -- ", + "alternatives": ["git checkout stash@{0} -- "] }, { "title": "Show all tracked files", "tip": "git ls-files -t" @@ -228,6 +232,9 @@ }, { "title": "Restore deleted file.", "tip": "git checkout ^ -- " +}, { + "title": "Restore file to a specific commit-hash", + "tip": "git checkout -- " }, { "title": "Always rebase instead of merge on pull.", "tip": "git config --global branch.autosetuprebase always"