I will explain using as a basis the documentation of the git stash create
:
create
Create a stash entry (which is a regular commit object) and return its object name, without storing it anywhere in the ref namespace. This is intended to be useful for scripts. It is probably not the command you want to use; see
"push" above.
The command create
will create a reference of stash
and return your id, however, will not put it in the stack of stashes
. So if you carry out the command git stash list
, he won’t be there.
For example:
$ git stash create
7iFcnyu9Nxtzrmaskq2eZT5MGUK3CgfQpSRj48HV
This -> 7iFcnyu9Nxtzrmaskq2eZT5MGUK3CgfQpSRj48HV
is the reference of stash
created, as the documentation itself tells us, this is useful when used in scripts, where conditionally (or for any other reason) you can save several references to stashes
and store them using the command store
when it suits you:
$ git stash store 7iFcnyu9Nxtzrmaskq2eZT5MGUK3CgfQpSRj48HV
$ git stash list
stash@{0}: Created via "git stash store".
The command store
will include the reference in the stack of stashes
, you can also change the label by adding to the stack:
$ git stash store -m "Meu stash fantastico" 7iFcnyu9Nxtzrmaskq2eZT5MGUK3CgfQpSRj48HV
$ git stash list
stash@{0}: Meu stash fantastico
I think I get it, like a script that pulls in the repositories, but first wants to stash and leave a comment. thanks :)
– user155240