开发者

Version Control that Discards Old History

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 c开发者_运维问答leanup 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.


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.


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.

Version Control that Discards Old History

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜