1

I'm using svn with my code. I want to ask, if there is any way to make checkpoints with svn?

I have checkout of code on local drive. After making first part of changes I see that everything is OK. After second part of changes code is broken. I want to get back to point after first part of changes and before changes done after. So now I make patch file (with svn diff) and revert all code then patch it. I'm wondering is there svn command to make checkpoint after first part of changes and then simply back to this checkpoint with single svn command. I don’t want to commit my changes after first part of changes.

Anthon
  • 69,918
  • 32
  • 186
  • 246
MarcnB
  • 31
  • 3
  • I'm surprised you couldn't find this out in an internet search. I'd suggest trying to GIT. There is a huge amount of support for it right now. – ouflak May 07 '15 at 07:13
  • In my company we are using svn, so change to GIT isn't possible so far and I have to use SVN – MarcnB May 07 '15 at 07:43
  • @MarcnB check my answer below. You can solve your issue by configuring git handle svn. This way you are still using svn, but you have an underlying git, that is not visible to others, to manage your local changes. – sestus May 07 '15 at 08:08

2 Answers2

1

I believe that the right terminology is svn save points. There is this ongoing feature design, but as far as I know it has not shipped yet.

Anyway, I was also looking for that functionality, as my company uses svn, and I solved it by configuring git over svn. Using this architecture, you have a local git repository, that "talks" to the remote svn repo, and thus you can benefit from the advantages of git (cheap branching, stash, etc), while still using svn in practice.

This "checkpoint" you want to implement can be accomplished via git's stash, or via creating a new branch (very easy and common practice in git) and use commits as your checkpoints (of course these commits will not be seen in svn - which is what you want if I get it right)

sestus
  • 1,875
  • 2
  • 16
  • 16
  • I think the underlying message here is that distributed systems *like* git are designed to very easily support this workflow. If you're going to try this you may want to experiment a little to find the right system for your own preferences. – Ben May 07 '15 at 12:38
1

The traditional way to do this with SVN would be:

  1. Create a new SVN branch that you will use as your own sandbox (using 'svn copy').

  2. Switch your local checkout over to the SVN branch you just created (using 'svn switch' followed by the URL of the newly created branch)

  3. Start making changes. Whenever you want to create a 'checkpoint', to a 'svn commit'. This commit will commit the changes to your private branch only, so nobody else will see them (unless they deliberately go looking for your branch, of course).

  4. If, after making some changes, you decide they are all wrong and you want to revert back to your most-recently-committed checkpoint, a "svn --recursive revert ." at the top level of your SVN checkout folder will revert your SVN checkout back to the state of your most recent commit.

  5. If you want to go further and revert committed changes, you can do that via "svn merge -rXXXX:YYYY" where XXXX and YYYY are the SVN revision number of the change you want to revert, and YYYY is the number one less than that number.

  6. When you're done making changes and happy with the results, and you've committed all of your local changes to the branch, you'll probably want to merge all of your branch's changes back into the trunk so that other people can see/use them.

After that you can continue working in the trunk if you like, or you can create another private branch if you prefer and repeat the process again.

Community
  • 1
  • 1
Jeremy Friesner
  • 70,199
  • 15
  • 131
  • 234