diff --git a/README.md b/README.md index fffb39d..c71736d 100644 --- a/README.md +++ b/README.md @@ -60,12 +60,16 @@ For clarity's sake all examples in this document use a customized bash prompt in - [Possible issues with interactive rebases](#possible-issues-with-interactive-rebases) - [The rebase editing screen says 'noop'](#the-rebase-editing-screen-says-noop) - [There were conflicts](#there-were-conflicts) + - [Stashing](#stashing) + - [Stash all edits](#stash-all-edits) + - [Stash specific file](#stash-specific-file) + - [Stash with message](#stash-msg) + - [Apply a specific stash from list](#stash-apply-specific) - [Miscellaneous Objects](#miscellaneous-objects) - [Clone all submodules](#clone-all-submodules) - [Delete tag](#delete-tag) - [Recover a deleted tag](#recover-a-deleted-tag) - [Deleted Patch](#deleted-patch) - - [Stash with message](#stash-msg) - [Tracking Files](#tracking-files) - [I want to change a file name's capitalization, without changing the contents of the file.](#i-want-to-change-a-file-names-capitalization-without-changing-the-contents-of-the-file) - [I want to remove a file from git but keep the file](#i-want-to-remove-a-file-from-git-but-keep-the-file) @@ -873,6 +877,51 @@ If at any time you want to stop the entire rebase and go back to the original st ```sh (my-branch)$ git rebase --abort ``` + +## Stash + + +### Stash all edits + +To stash all the edits in your working directory + +```sh +$ git stash +``` + + +### Stash specific file + +To stash only one file from your working directory + +```sh +$ git stash push working-directory-path/filename.ext +``` + + +### Stash with message + +```sh +$ git stash save +``` + + +### Apply a specific stash from list + +First check your list of stashes with message using + +```sh +$ git stash list +``` + +Then apply a specific stash from the list using + +```sh +$ git stash apply "stash@{n}" +``` + +Here, 'n' indicates the position of the stash in the stack. The topmost stash will be position 0. + ## Miscellaneous Objects @@ -926,13 +975,6 @@ From github.com:foo/bar * [new ref] refs/pull/1/head -> pr_1 ``` - -### Stash with message - -```sh -$ git stash save -``` - ## Tracking Files