2

I'm looking for a version control system that protects me against mistakes that I may have made recently (no more than a week) and discards the rest. Is there one which makes this kind of automated cleanup very easy?

For the record, I'm using SVN, but I'm not asking how to get SVN to do this, but rather asking if there is a VCS that makes this easy.

manojlds
  • 290,304
  • 63
  • 469
  • 417
Alan Turing
  • 12,223
  • 16
  • 74
  • 116
  • 4
    Why? Why would you want to lose information about historical revisions? – Oliver Charlesworth Aug 19 '11 at 19:56
  • 1
    Create a folder each day. do you work after seven days delete the oldest folder. *kidding* – Doug Chamberlain Aug 19 '11 at 19:58
  • 2
    Throwing away history kinda defeats the purpose of using version control. – Alex Howansky Aug 19 '11 at 19:59
  • 1
    @Doug: Heh, I was going to suggest just using tar... :) – Alex Howansky Aug 19 '11 at 20:00
  • a VCS is not a backup tool. What will you do with your branches? How will you keep tagged revisions? No VCS will make it easy, because if it did, it wouldn't be a VCS anymore. – JB Nizet Aug 19 '11 at 20:50
  • I think it's interesting that I got down votes for this question. Have you considered that some people use VCS different than others? Why is it not a "backup" tool? What *is* a "backup" tool? To answer your question, @Oil, it's a space constraint issue. The way I and a few other teammates work with SVN is we very actively work on something for 1-2 weeks and move to a different part. We generate quite a few binaries (pdf, images, videos), older versions of which do not ever get reverted to. So while I might want to keep infinite history on source code, I want to delete old history for binaries – Alan Turing Aug 19 '11 at 20:58
  • Bah, that's a first downvoted question for me. Hard not to take it personally, but I'll get over it ;-) I still think it's a valid question. – Alan Turing Aug 19 '11 at 21:02
  • 1
    A disk drive of 1TB (1TB!!!) costs less than 100$. Do yourself a favor and buy one. If you really really want to do this, then create a repo, use it for one week, then create another one and import the latest revision of the first one. Keep the old repo for one week just in case, and repeat this operation every week. – JB Nizet Aug 19 '11 at 21:06
  • Use git with rebase - look here for more details: http://stackoverflow.com/questions/495345/git-removing-selected-commits-from-repository – Petr Kozelka Aug 19 '11 at 21:11

2 Answers2

2

You can used Subversion to do this. At the end of the week do an SVNADMIN dump to some location to preserve your repo, then do a SVNDUMPFILTER from the HEAD of the dumped file to create a new repo replacing your existing repo.

Here is a screen shot to illustrate my point.

enter image description here

Repeat each week as necessary

The best part is you could go back to these older repos and restore them when (AND YOU WILL) you realize you need something older than a week

Community
  • 1
  • 1
Doug Chamberlain
  • 11,192
  • 9
  • 51
  • 91
2

Without questioning your reasoning for doing this:

You must be able to do this in a number of ways with git, below is one of them:

git fast-export master --since "1 week ago" | (cd ../newrepo.git && git init . && git fast-import && git checkout)

You export out commits from last week, import into a new repo. You can do it in the same repo if you want too:

git fast-export master --since "1 week ago" | (rm -rf .git && git init . && git fast-import && git checkout)

I like how you can specify like 1 week ago, yesterday, now etc. ( http://www.kernel.org/pub/software/scm/git/docs/gitrevisions.html ) in Git to reference revisions. It really makes it very easy to find revisions you want.

manojlds
  • 290,304
  • 63
  • 469
  • 417