Does hg, svn or others have an option like git stash?
3 Answers
The general name for that feature is:
Shelving: the ability to actually upload intermediate revisions to the server without really checking them in.
In a CVCS (Centralized VCS), you actually need to upload those intermediate data to a central server.
But in a DVCS (Distributed VCS), you just need to store them in a the local repository.
There is:
- the shelve extension for Mercurial
- temporary branches for SVN, or patch files
- p4tar (again patch based) for Perforce, even though the Perforce 2009.2 has now shelve and unshelve features.
- saved checked-out data in Plastic SCM (for shelving data)
You can find all the other SCM shelving commands in this SCM comparison table on Wikipedia.
- Accurev:
keep / co(this is disputed in this question) - Bazaar: shelve / unshelve
- Darcs: revert / unrevert
-
1Alternately, for Mercurial: http://stackoverflow.com/questions/6158419/hg-mercurial-any-way-to-set-aside-the-working-copy-for-later – Matt Ball Jul 16 '11 at 22:34
-
Possibly WP has changed since this answer, but Accurev's entry shows no support for shelving :( – Matt Sach Nov 22 '17 at 10:34
-
@MattSach Yes, this must have changed after this 2013 question: https://stackoverflow.com/q/19765112/6309 – VonC Nov 22 '17 at 10:37
Jazz Source Control, integrated in IBM Rational Team Concert supports this functionality. It is called "Suspend".
From the Jazz.net site: "Jazz allows you to temporarily remove a change set from your workspace by suspending it. At some point in the future, you can resume the change set and continue working on it."

- 666
- 6
- 16
-
This isn't really equivalent because its not intermediate. When you "suspend" you have removed it from your workspace but the check-in has occurred (the component has a new changeset) – Oliver Feb 07 '12 at 21:26
-
2When you _Suspend_ a Changeset, the _code_ is removed from your Local Workspace **and** from your Repository Workspace. It is in your component but only as a "Shelved" or "Suspended" changeset. That means that if someone loads that repository and compiles the project it will **not** contain those changes. So, in what sense is this different from Shelve or Stash? – macrobug Feb 23 '12 at 15:11
If you don't want to use shelves, you can do it the following way.
hg diff > mylocalchanges.txt
hg revert -a
# Do your merge here, once you are done, import back your local mods
hg import --no-commit mylocalchanges.txt

- 5,690
- 1
- 32
- 29