Git /
StashingChangesIf you are in the middle of working on something but need to look at an earlier version or a different branch of the repository, you will need to stash your uncommitted changes before doing so. Stashing changes is done with
and a list of stashes can be accessed with
Stashing changes means that they are temporarily put away for later use, in a way similar to a commit. Once you come back and are ready to work again, you can reapply the changes with
Unlike branches and earlier commits, stashes are not saved, which means that once popped, they go away. It is not a different form of version control but a quick and dirty way to temporarily put something on hold while looking at something else. It is also possible to apply a stash, that is, to modify the files, without hiding the commit, with
optionally with the hash or identification of the stash. This enables you to apply the changes, check that they were properly done, and then remove the stash with
with, again, the option to specify If you didn't apply then drop, but popped the stash then lost it, it is possible to retrieve the stash by looking for what git calls "dangling" commits:
which will return a list of hashes corresponding to commits which aren't tied to anything (ie dangling). Use |