The actual data hidden by the "git stash" symbol (ie the current version of the working tree and the contents of .git / index) is stored as two commit trees.
One compilation tree contains a snapshot of the current state of the working tree. There are some complex snippets here, see below.
Another compilation tree, I was told, is used to store a snapshot of the contents of .git / index during saving. I have not looked deep into it (yet) deep enough to understand how it translates into another.
.git / refs / stash contains a hash value for the commit tree created by the application.
.git / logs / refs / stash contains a reflog-like piece of metadata about entries before that located in .git / refs / stash.
.git / index contains a list of entries, one for each of the files in the working tree. These entries contain the full path and file name, as well as cached file metadata, file system metadata, and git metadata.
"git add" both adds a copy of the file to the object store and sets the setting flag for this file in .git / index.
For "git stash" to create a commit tree, files that have been modified (edited) but not yet delivered with "git add" must be added to the object store. "git stash" does this by creating a temporary index file.
source share