开发者

Could git do not store history of specific folders when working with git-svn?

In short: Is there a way to disable storing full history for specific folders in git-svn repo?

We have pretty large SVN repo with big checkout. I would like to migrate it to Git for my local development, because Git speeds up update and status commands orders of magnitude.

When I simply do git svn clone it creates very big repo. Big enough to be bigger then my whole HDD. The problem lies in binary directories for which history is too large.

Latest binaries are required for proper local build, but history is not required at all for my development process. I will never change them myself.

I would like to store only latest versions for specific folders, or may be a history, but for no more than a week.

I could only found filter for git svn fetch, which excludes specific folders at all. This is not exactly what I need.

It's OK with me to have Cron task which deletes history from specific folders, but I do not know how to make one. Also Cron does not solve problem of first git svn clone.

P.S. SVN repository structure could not be changed b开发者_运维技巧y any means.


I ended up with the next solution:

  1. There are three folders with binaries, so I added them to git-svn ignored folders so they will not be stored by git at all
  2. Manually add these folders to git working space with svn version control
  3. Made up script, which updates these folders at once by cron

Now I have pretty strange workspace where some folders are managed by svn and others by git, but looks like it is working solution for now.


you can do a shallow copy by specifying how much svn history to clone. for example:

$ git svn clone -s -r534:HEAD http://some/svn/repo

this will clone only the history since revision 534. You just have to figure out the right number for your repository and pull, for example, the last 6 revisions. Just specify a number 6 less than the current revision.

Update:

After thinking about your problem a bit more, I think that shallow clones are not really the right way to go because you cannot push/merge them - they are designed just for you to send patches to them in via email.

Have you tried marking the relevant files as binary before you do a git-svn clone? You can do this by adding the following line to your .gitattributes file (in repository root) after running git init:

*.jpg binary

Obviously, replace the extension with that of your binary files (or name them specifically I guess). Git tries to recognise binary files automatically, but it doesn't always get it right.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜