diff --git a/README.md b/README.md index 2531761..bd9412a 100644 --- a/README.md +++ b/README.md @@ -26,6 +26,11 @@ * [Pick commits across branches using cherry-pick](https://github.com/git-tips/tips#pick-commits-across-branches-using-cherry-pick) * [Find out branches containing commit-hash](https://github.com/git-tips/tips#find-out-branches-containing-commit-hash) * [Git Aliases](https://github.com/git-tips/tips#git-aliases) +* [Saving current state of tracked files without commiting](https://github.com/git-tips/tips#saving-current-state-of-tracked-files-without-commiting) +* [Show list of all saved stashes](https://github.com/git-tips/tips#show-list-of-all-saved-stashes) +* [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) @@ -161,5 +166,42 @@ git config --global alias. git config --global alias.st status ``` +## Saving current state of tracked files without commiting +```sh +git stash +``` + +## Show list of all saved stashes +```sh +git stash list +``` + +## Apply any stash without deleting from the stashed list +```sh +git stash apply +``` + +## Apply last stashed state and delete it from stashed list +```sh +git stash pop +``` + + +__Alternatives:__ +```sh +git stash apply stash@{0} && git stash drop stash@{0} +``` + +## Delete all stored stashes +```sh +git stash clear +``` + + +__Alternatives:__ +```sh +git stash drop +``` + diff --git a/tips.json b/tips.json index 1c87026..c6b3a69 100644 --- a/tips.json +++ b/tips.json @@ -92,5 +92,27 @@ { "title": "Git Aliases", "tip": "git config --global alias. \ngit config --global alias.st status" + }, + { + "title":"Saving current state of tracked files without commiting", + "tip": "git stash" + }, + { + "title":"Show list of all saved stashes", + "tip": "git stash list" + }, + { + "title": "Apply any stash without deleting from the stashed list", + "tip": "git stash apply " + }, + { + "title":"Apply last stashed state and delete it from stashed list", + "tip": "git stash pop", + "alternatives": ["git stash apply stash@{0} && git stash drop stash@{0}"] + }, + { + "title": "Delete all stored stashes", + "tip": "git stash clear", + "alternatives": ["git stash drop "] } ]