User Tools

Site Tools


git_stash

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
git_stash [2019/02/26 19:10]
rpjday
git_stash [2019/02/26 19:18] (current)
rpjday [git stash branch]
Line 143: 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.
 +</​code>​
 +
 +===== How stashes are implemented =====
 +
 +Stashes are represented by three new commits in the object store, referenced by stash pointers only:
 +
 +  * ''​stash@{0}'':​ The final result, both staged and unstaged content
 +  * ''​stash@{0}^1'':​ The base commit from which the stash is derived
 +  * ''​stash@{0}^2'':​ Commit representing just staged content
 +
 +The //full// content of the stash:
 +
 +<​code>​
 +$ 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.
 + ​Please read the Documentation/​process/​changes.rst file, as it contains the
 + ​requirements for building and running the kernel, and information about
 + the problems which may result by upgrading your kernel.
 ++
 ++
 ++
 ++unstaged stuff
 ++
 +$
 +</​code>​
 +
 +The staged content only:
 +
 +<​code>​
 +$ 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
 + ​============
 + 
 +$
 +</​code>​
 +
 +Finally, the unstaged content:
 +
 +<​code>​
 +$ 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.
 + ​Please read the Documentation/​process/​changes.rst file, as it contains the
 + ​requirements for building and running the kernel, and information about
 + the problems which may result by upgrading your kernel.
 ++
 ++
 ++
 ++unstaged stuff
 ++
 +$
 </​code>​ </​code>​
git_stash.txt ยท Last modified: 2019/02/26 19:18 by rpjday