开发者

Git working copy within a Subversion Repository

I have a project at work, and we use Subversion to version control everything. However, we have a client for a particular project who has used Git for something I need to check out and put in our project repository. Normally I would just check out the Git r开发者_JS百科epo, export it into my SVN working copy, version the files, and be done with it. However, the guy regularly updates this code, and I need to stay near where he is at.

What would happen if I just check out the Git repository into my SVN working copy and version the files?

NOTE Git-svn is not an option, I have never used it and unfortunately I don't have time to learn something new for this.


Just clone the Git repo. Nothing bad would happen and you will be able to update that code by doing git update. You can safely commit a git repo into subversion, I have done it before.


There aren't any technical problems with this, but it will wind up being a hassle. Every time you make a change, you will need to commit it to Git, then add all of the new files that were created in the Git repository to Subversion, then commit all of that to Subversion. When you merge any of his changes in, you'll need to do all of that as well.

One question I have is why would you want to do this; what benefit do you gain from having it in Subversion? If you're going to need to merge changes with his upstream repository, then you'll need to learn Git anyhow. At that point, you might as well just use Git to do your version control, and not complicate things by trying to integrate with Subversion. If you're just going to send him the final code, and let him integrate it, then why bother checking the Git repo into Subversion? Just do what you normally do, check the current copy into Subversion, work on it, and then send him the final result when you're done.

git-svn would be useful if the official upstream copy of the code were in Subversion, but you wanted to work on it using Git because you prefer Git. It is not all that helpful for working with an upstream project that is managed in Git when you want to work with Subversion tools.


Your proposed solution should work as git and svn have different meta files, and as long as you don't add the metafiles for one version control system into the the other, there is no conflict between them.

Note, though, that whenever you change your files you will have to add them to both git and subversion, and thus you will have to deal with two different file control systems.

As you hint, using git-svn would help you, as it would allow you work with git only and then use git-svn to synchronize with your central svn repo. I'm doing this at work, and it is very simple to do and it works flawlessly (most of the time). I would consider learning it, I were you. You will have to learn git in any case to work efficiently with the client, and learning git-svn is relatively simple. You basically just three commands:

  • git svn fetch - to get the latest svn changes to your repo
  • git rebase git-svn - to incorporate the svn changes
  • git svn dcommit - to commit to the svn repo

Learning git is well worth it, as in the end, I find it vastly superior to svn.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜