简体   繁体   English

git svn - 我可以同时使用git和svn吗?不需要git和svn之间的交互

[英]git svn - Can I use git and svn at the same time? no need interaction between git and svn

I am doing a development project. 我正在做一个开发项目。

The company is using SVN , so for main commit and checkout should be done via SVN . 该公司正在使用SVN ,因此主要commitcheckout应通过SVN完成。

However, I don't like SVN and am a git user. 但是,我不喜欢SVN并且是git用户。 Since only when I think my code is good I will commit to the company SVN , I would like to use git for my own history keeper. 因为只有当我认为我的代码是好的时候我才会致力于公司SVN ,我想将git用于我自己的历史管理员。

I don't need to use git to do SVN thing, nor vice versa. 我不需要使用git来做SVN事情,反之亦然。

Can I version control my same code using SVN and git at the same time? 我可以同时使用SVN和git对我的相同代码进行版本控制吗? No interaction between them. 他们之间没有互动。

You can clone a subversion repository to your machine using git svn clone <SVN repo URL> . 您可以使用git svn clone <SVN repo URL>将subversion存储库克隆到您的计算机。 The code will be available as a git repository. 该代码将作为git存储库提供。 You can do your work there and make local commits as you please. 您可以在那里工作并根据需要进行本地提交。 There is a command line option to get a "shallow" checkout rather than the entire repository which is often useful. 有一个命令行选项可以获得“浅”结帐,而不是整个存储库,这通常很有用。 I forget what it is. 我忘了它是什么。

Anytime, you want to run the equivalent of svn update , do a git svn rebase . 任何时候,你想运行相当于svn update ,做一个git svn rebase This will fetch new commits which were checked into SVN after you last synchronised and then rebase your changes onto the new tip. 这将获取在您上次同步后检入SVN的新提交,然后将您的更改重新绑定到新提示。

When you're ready with your commits, do a git svn dcommit . 当你准备好你的提交时,做一个git svn dcommit This will send all your new commits to svn one by one. 这会将您的所有新提交逐个发送到svn。 You can also squash your local commits into a single one and send it by first doing a local rebase and then an svn dcommit. 您还可以将本地提交压缩为单个提交,然后首先执行本地rebase,然后再执行svn dcommit。 This should be done on the initial branch (usually master ). 这应该在初始分支(通常是master分支)上完成。

The very fact that you're checking out from subversion and then working locally in git means that there is "interaction" between them so your last statement is not valid. 事实上你从subversion中检出然后在git中本地工作意味着它们之间存在“交互”,所以你的最后一个语句是无效的。

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

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