diff --git a/snippets/apply-latest-stash.md b/snippets/apply-latest-stash.md new file mode 100644 index 000000000..2c44420ac --- /dev/null +++ b/snippets/apply-latest-stash.md @@ -0,0 +1,16 @@ +--- +title: Apply the latest stash +tags: stash,repository,intermediate +--- + +Applies the latest stash. + +- Use `git stash apply` to apply the latest stash. + +```sh +git stash apply +``` + +```sh +git stash apply # Applies the latest stash +``` diff --git a/snippets/apply-stash.md b/snippets/apply-stash.md new file mode 100644 index 000000000..28cd36f1e --- /dev/null +++ b/snippets/apply-stash.md @@ -0,0 +1,16 @@ +--- +title: Apply a stash +tags: stash,repository,intermediate +--- + +Applies a specific stash. + +- Use `git stash apply ` to apply the given ``. + +```sh +git stash apply +``` + +```sh +git stash apply stash@{1} # Applies `stash@{1}` +``` diff --git a/snippets/delete-stash.md b/snippets/delete-stash.md new file mode 100644 index 000000000..771fbe4a6 --- /dev/null +++ b/snippets/delete-stash.md @@ -0,0 +1,16 @@ +--- +title: Delete a stash +tags: stash,repository,intermediate +--- + +Deletes a specific stash. + +- Use `git stash drop ` to delete the given ``. + +```sh +git stash drop +``` + +```sh +git stash drop stash@{1} # Deletes `stash@{1}` +``` diff --git a/snippets/delete-stashes.md b/snippets/delete-stashes.md new file mode 100644 index 000000000..653921aef --- /dev/null +++ b/snippets/delete-stashes.md @@ -0,0 +1,17 @@ +--- +title: Delete all stashes +tags: stash,repository,intermediate +--- + +Deletes all stashes. + +- Use `git stash clear` to delete all stashes. + +```sh +git stash clear +``` + +```sh +git stash clear +# Deletes all stashes +``` diff --git a/snippets/list-stashes.md b/snippets/list-stashes.md new file mode 100644 index 000000000..3139040ba --- /dev/null +++ b/snippets/list-stashes.md @@ -0,0 +1,17 @@ +--- +title: Lists all stashes +tags: stash,repository,intermediate +--- + +Displays a list of all stashes. + +- Use `git stash list` to view a list of all stashes. + +```sh +git stash list +``` + +```sh +git stash list +# stash@{0}: WIP on patch-1: ee52eda Fix network bug +``` diff --git a/snippets/save-stash.md b/snippets/save-stash.md new file mode 100644 index 000000000..20bdabad8 --- /dev/null +++ b/snippets/save-stash.md @@ -0,0 +1,25 @@ +--- +title: Create a stash +tags: stash,repository,intermediate +--- + +Saves the current state of the working directory and index into a new stash. + +- Use `git stash save` to save the current state of the working directory and index into a new stash. +- You can optionally use the `-u` option to include untracked files. +- You can optionally provide a `` for the stash. + +```sh +git stash save [-u] [] +``` + +```sh +git stash save +# Creates a new stash + +git stash save -u +# Creates a new stash, including untracked files + +git stash save "Bugfix WIP" +# Creates a new stash with the message "Bugfix WIP" +```