15

Does hg, svn or others have an option like git stash?

igorw
  • 27,759
  • 5
  • 78
  • 90
Juanjo Conti
  • 28,823
  • 42
  • 111
  • 133

3 Answers3

16

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:

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
Matt Sach
  • 1,162
  • 16
  • 37
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • 1
    Alternately, 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
5

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."

Jazz Source Control FAQ

macrobug
  • 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
  • 2
    When 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
1

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
minaz
  • 5,690
  • 1
  • 32
  • 29