简体   繁体   English

有什么原因我不能仅仅使用git来跟踪对svn结帐的更改?

[英]Are there any reasons I can't just use git to track changes to my svn checkout?

I have gotten used to using git on some of my home projects and work projects to track the changes I make in my own folders. 我已经习惯在一些家庭项目和工作项目上使用git来跟踪我在自己的文件夹中所做的更改。 I would like to use it to track the changes I make to a set of files in an svn checkout. 我想用它来跟踪我对svn签出中的一组文件所做的更改。

I have read about git-svn and it just seems like it is more than I want/need at this point. 我已经阅读了有关git-svn的信息,这似乎比我现在想要的要多。

I think all I really want to do (at this point) is to use git to track changes to a set of files / directories that just "happen" to be an svn checkout. 我认为我现在真正想要做的就是使用git跟踪对只是“碰巧”成为svn签出的一组文件/目录的更改。

I am thinking I would even include the .svn directory in git as well (but not include the .git directory in svn). 我在想什至在git中也包括.svn目录(但在svn中不包括.git目录)。 The idea being if I switch back to an old branch, my checkout would be exactly the same as it was when I last left it. 想法是,如果我切换回旧分支,我的结帐将与上次离开时​​的结帐完全相同。

This seems like a strait forward approach to me, is there some specific reasons this would not work? 对我来说,这似乎是一种海峡前进的方法,是否有某些特定原因无法解决?

I do this too. 我也是 I turn an svn checkout to an independent git repo at the same time. 我同时将svn结帐转到独立的git repo。 However, I don't include the .svn directories and I think you shouldn't. 但是,我不包括.svn目录,我认为您不应该包含。

The practical advantages I'm using every day: 我每天使用的实际优势:

  • git ls-files | grep file-im-looking-for
  • git grep something-im-looking-for
  • Local experimental branches 本地实验分支

These are really serious benefits for me over a simple Subversion checkout. 通过简单的Subversion结帐,这些对我来说确实是非常重要的好处。

Why not use Git in the first place without Subversion? 为什么不使用Subversion首先不使用Git? I have no control over the repository owner, so don't really have a choice. 我无法控制存储库所有者,因此别无选择。 And git-svn is too fragile with large repositories. 而且git-svn对于大型存储库来说太脆弱了。

Finally, I add .gitignore to the Subversion repository, and mark the .git folder ignored. 最后,我将.gitignore添加到Subversion存储库中,并将.git文件夹标记为已忽略。 This is practical for my colleagues who also do this kind of thing. 这对于也做这种事情的同事来说都是很实际的。 I'm also sort of counting on other developers to see such Git related stuff in the Subversion repository, I hope to make them wonder, and possibly fuel my agenda of migrating the repo to Git. 我还指望其他开发人员可以在Subversion存储库中看到与Git相关的东西,我希望使他们感到惊讶,并有可能加深我将回购迁移到Git的议程。

I've tracked largeish, very active SVN repositories ( Dungeon Crawl Stone Soup , if you absolutely need to know) for a long time, no trouble at all. 很长时间以来,我一直在跟踪大型的,非常活跃的SVN存储库(如果绝对需要了解,则是Dungeon Crawl Stone Soup ),一点也不麻烦。 Didn't do anything in the direction of pushing changes, though, just used git to pack up my (minor) patches to report on their bug tracker. 但是,在推动更改方面并没有做任何事情,只是使用git打包了我的(较小的)补丁以报告其错误跟踪器。 Only problem was that the initial clone took more than a day, IIRC. 唯一的问题是,最初的克隆花了一天多的时间,IIRC。 But then they migrated to git a while back... 但是后来他们又迁移到git了...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM