In a previous Git question, Daniel Benamy was talking about a workflow in Git:
I was working on master and committed some stuff and then decided I wanted
If you look for a workflow that may be more fitting than git stash, you may want to look at git-bottle. It's a utility for the purpose of saving and restoring the various git working states as normal git commits, effectively snapshotting the current and pertinent state of your working tree and all various file states shown under git status.
Key differences from git stash
:
git stash
saves the dirty git state narrowly (modified files, and added files in the index), whereas git-bottle
is designed to save everything that is different from HEAD
, and it differentiates in a preserving way between modified, modified and not added, not added, unmerged paths, and the complete rebase/merge states (only paths under .gitignore
are not saved).git stash
saves to stash objects that you need to keep track separately. If I stashed something 2 weeks ago I might not remember it, whereas git-bottle
saves as tentative commits to the current branch. The reverse action is git-unbottle
which is the equivalent of the git stash
pop. It is possible to push and share these commits among repositories. This can be useful for remote builds, where you have another repository in a remote server just for building, or for collaborating with other people on conflict resolution.