Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
| git_stash [2019/02/20 17:02] – [Throwing away stashes] rpjday | git_stash [2019/02/26 19:18] (current) – [git stash branch] rpjday | ||
|---|---|---|---|
| Line 19: | Line 19: | ||
| </ | </ | ||
| - | ===== git stash push ===== | + | ===== Basic stash operations ===== |
| + | |||
| + | ==== git stash push ==== | ||
| Save both the unstaged and staged content in a new stash: | Save both the unstaged and staged content in a new stash: | ||
| Line 42: | Line 44: | ||
| * '' | * '' | ||
| - | ===== git stash show ===== | + | ==== git stash show ==== |
| By default, show most recent stash: | By default, show most recent stash: | ||
| Line 62: | Line 64: | ||
| </ | </ | ||
| - | Show the actual content: | + | Show the actual content |
| < | < | ||
| Line 93: | Line 95: | ||
| </ | </ | ||
| - | ===== git stash pop/ | + | ==== git stash pop/apply ==== |
| Pop/apply the most recent stash, or a specified stash: | Pop/apply the most recent stash, or a specified stash: | ||
| Line 103: | Line 105: | ||
| </ | </ | ||
| - | Use '' | + | Use '' |
| < | < | ||
| Line 109: | Line 111: | ||
| </ | </ | ||
| - | ===== Throwing away stashes | + | ==== Throwing away stashes ==== |
| < | < | ||
| Line 117: | Line 119: | ||
| </ | </ | ||
| - | ===== Working with pathspecs | + | ==== Working with pathspecs ==== |
| '' | '' | ||
| Line 125: | Line 127: | ||
| </ | </ | ||
| - | ===== git stash branch | + | ==== git stash branch ==== |
| < | < | ||
| Line 141: | Line 143: | ||
| commit that was HEAD at the time git stash was run, it | commit that was HEAD at the time git stash was run, it | ||
| restores the originally stashed state with no conflicts. | restores the originally stashed state with no conflicts. | ||
| + | </ | ||
| + | |||
| + | ===== How stashes are implemented ===== | ||
| + | |||
| + | Stashes are represented by three new commits in the object store, referenced by stash pointers only: | ||
| + | |||
| + | * '' | ||
| + | * '' | ||
| + | * '' | ||
| + | |||
| + | The //full// content of the stash: | ||
| + | |||
| + | < | ||
| + | $ git diff stash@{0}^1 stash@{0} | ||
| + | diff --git a/README b/README | ||
| + | index 669ac7c32292..9c61fa8595e9 100644 | ||
| + | --- a/README | ||
| + | +++ b/README | ||
| + | @@ -1,3 +1,8 @@ | ||
| + | +staged stuff | ||
| + | + | ||
| + | + | ||
| + | + | ||
| + | + | ||
| + | Linux kernel | ||
| + | | ||
| + | |||
| + | @@ -16,3 +21,8 @@ several of them using the Restructured Text markup notation. | ||
| + | | ||
| + | | ||
| + | the problems which may result by upgrading your kernel. | ||
| + | + | ||
| + | + | ||
| + | + | ||
| + | +unstaged stuff | ||
| + | + | ||
| + | $ | ||
| + | </ | ||
| + | |||
| + | The staged content only: | ||
| + | |||
| + | < | ||
| + | $ git diff stash@{0}^1 stash@{0}^2 | ||
| + | diff --git a/README b/README | ||
| + | index 669ac7c32292..ded86dccf25a 100644 | ||
| + | --- a/README | ||
| + | +++ b/README | ||
| + | @@ -1,3 +1,8 @@ | ||
| + | +staged stuff | ||
| + | + | ||
| + | + | ||
| + | + | ||
| + | + | ||
| + | Linux kernel | ||
| + | | ||
| + | |||
| + | $ | ||
| + | </ | ||
| + | |||
| + | Finally, the unstaged content: | ||
| + | |||
| + | < | ||
| + | $ git diff stash@{0}^2 stash@{0} | ||
| + | diff --git a/README b/README | ||
| + | index ded86dccf25a..9c61fa8595e9 100644 | ||
| + | --- a/README | ||
| + | +++ b/README | ||
| + | @@ -21,3 +21,8 @@ several of them using the Restructured Text markup notation. | ||
| + | | ||
| + | | ||
| + | the problems which may result by upgrading your kernel. | ||
| + | + | ||
| + | + | ||
| + | + | ||
| + | +unstaged stuff | ||
| + | + | ||
| + | $ | ||
| </ | </ | ||