I am reading https://stackoverflow.com/a/6925136/156458 for learning git stash
.
I was wondering if git stash save
in the first method and git stash
in the second are the same? What difference does save
make?
I am reading https://stackoverflow.com/a/6925136/156458 for learning git stash
.
I was wondering if git stash save
in the first method and git stash
in the second are the same? What difference does save
make?
Yes, they are the same.
With git stash save
you can provide an optional message that will be used for the stash, so it can be found more easily in the future.
A quick quote from the documentation of git stash
:
DESCRIPTION
Use
git stash
when you want to record the current state of the working directory and the index, but want to go back to a clean working directory. The command saves your local modifications away and reverts the working directory to match theHEAD
commit.The modifications stashed away by this command can be listed with
git stash list
, inspected withgit stash show
, and restored (potentially on top of a different commit) withgit stash apply
. Callinggit stash
without any arguments is equivalent togit stash save
.
Now, git stash save
has been deprecated, and now we should use git stash push
.
git stash push
will stash tracked filesgit stash push -u
will stash untracked filesgit stash push -a
will stash ignored filesMore information is here