Add stash snippets
This commit is contained in:
16
snippets/apply-latest-stash.md
Normal file
16
snippets/apply-latest-stash.md
Normal file
@ -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 <stash>
|
||||||
|
```
|
||||||
|
|
||||||
|
```sh
|
||||||
|
git stash apply # Applies the latest stash
|
||||||
|
```
|
||||||
16
snippets/apply-stash.md
Normal file
16
snippets/apply-stash.md
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
---
|
||||||
|
title: Apply a stash
|
||||||
|
tags: stash,repository,intermediate
|
||||||
|
---
|
||||||
|
|
||||||
|
Applies a specific stash.
|
||||||
|
|
||||||
|
- Use `git stash apply <stash>` to apply the given `<stash>`.
|
||||||
|
|
||||||
|
```sh
|
||||||
|
git stash apply <stash>
|
||||||
|
```
|
||||||
|
|
||||||
|
```sh
|
||||||
|
git stash apply stash@{1} # Applies `stash@{1}`
|
||||||
|
```
|
||||||
16
snippets/delete-stash.md
Normal file
16
snippets/delete-stash.md
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
---
|
||||||
|
title: Delete a stash
|
||||||
|
tags: stash,repository,intermediate
|
||||||
|
---
|
||||||
|
|
||||||
|
Deletes a specific stash.
|
||||||
|
|
||||||
|
- Use `git stash drop <stash>` to delete the given `<stash>`.
|
||||||
|
|
||||||
|
```sh
|
||||||
|
git stash drop <stash>
|
||||||
|
```
|
||||||
|
|
||||||
|
```sh
|
||||||
|
git stash drop stash@{1} # Deletes `stash@{1}`
|
||||||
|
```
|
||||||
17
snippets/delete-stashes.md
Normal file
17
snippets/delete-stashes.md
Normal file
@ -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
|
||||||
|
```
|
||||||
17
snippets/list-stashes.md
Normal file
17
snippets/list-stashes.md
Normal file
@ -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
|
||||||
|
```
|
||||||
25
snippets/save-stash.md
Normal file
25
snippets/save-stash.md
Normal file
@ -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 `<message>` for the stash.
|
||||||
|
|
||||||
|
```sh
|
||||||
|
git stash save [-u] [<message>]
|
||||||
|
```
|
||||||
|
|
||||||
|
```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"
|
||||||
|
```
|
||||||
Reference in New Issue
Block a user