27

Basically I want to stage my changes without pushing them and without switching branches. This allows me to do some work, commit it when I am at a good stopping point, and then continue work in the same branch. If I mess up, I can revert, if I add new changes, I can just commit again.

I realize I can create a feature branch in SVN to track these changes, but again, I'd like to do so while staying in the same branch/trunk. Even the equivalent of git stash would suffice, although it seems SVN doesn't have that feature.

Igor
  • 30,885
  • 14
  • 70
  • 107

3 Answers3

38

The very point of distributed version control is this feature of local commits that can at a later point be merged with the upstream repository. SVN is not distributed and cannot do it. The central hindrance is SVN's linear revision numbering, which implies that every client must get a new identifying revision number for each changeset. Since "allocating" a revision number and later using it would lead to all kinds of race conditions, the "commit" and "push" actions are atomic in SVN and every non-distributed version control system.

That being said, git's SVN frontend is a good choice, like Joe suggested. It makes sure that SVN never sees your local, individual commits, and the "push" is translated into a single, big SVN commit.

thiton
  • 34,333
  • 3
  • 63
  • 96
  • 3
    If you're referring to git-svn, then a push translates each git commit into an svn commit. However, one can manually squash the commits before pushing. – Max Nanasy Sep 01 '12 at 00:53
30

By design SVN does not, however you can use git's git svn command as a front-end to SVN. It allows you to do push/pull work from an SVN remote but still uses git locally, and thus to make local commits without pushing to SVN repository.

Something like this might help: http://www.viget.com/extend/effectively-using-git-with-subversion/

hdl
  • 878
  • 1
  • 7
  • 21
Joe
  • 2,937
  • 13
  • 23
  • 2
    From my understanding of SVN it is very much centralized based. Meaning if you commit anything it goes to the central repo. Other IDEs might do a local "Snapshot" while you make your changes, and save that. – Joe Dec 27 '11 at 21:58
2

You might be able to use quilt to do this, although it starts getting tricky if you only want to commit part of your quilt queue to svn.

Neil
  • 50,855
  • 8
  • 54
  • 69