本地 git 存储库创建
我从 svn 签出了代码库。 (code_base
)。我想从这个代码库创建一个本地 git 存储库,然后使用 git 分支来使用它。因此,我期待如下结构:
当前可用的代码 = c:/code_base
同一台机器上的 git repo = c:/repo_head
(基于 c:/code_base
)
git client from new repo = c:/repo_client1 c:/repo_client2
我正在尝试创建一个裸存储库 (repo_head
),然后尝试添加 code_base 但它似乎不起作用。我收到很多错误。 最好的方法是什么?
I have code base checked out from svn. (code_base
). I want to create a local git repo from this code base and then use git branches to play with it. So, I am expecting a structure like follows:
currently available code = c:/code_base
git repo on same machine = c:/repo_head
(Based on c:/code_base
)
git clients from newly repo = c:/repo_client1 c:/repo_client2
I am trying to create a bare repo (repo_head
) and then trying to add code_base
but it does not seem to work. I am getting lot of errors.
What is the best way to go about it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
最简单的方法可能是创建文件夹 repo_head 然后运行,
然后将 code_base 中的所有内容复制到 repo_head 中。最后
你将拥有一个新的 git 存储库可以使用!
您可能只需将 code_base 初始化为 git 存储库,但我不确定它如何与 svn 元数据交互。 。 。
The easiest way is probably to create the folder repo_head then run
then copy all the contents from code_base into repo_head. Finally
then you will have a new git repo to play with!
You could probably just initialize code_base as a git repo but I'm not sure how that interacts with the svn meta data . . .
我在 svn 工作目录中初始化并运行 git repo 取得了令人惊讶的成功。因此,我从 SVN 检出到一个目录,
cd
进入该目录,执行git init
,然后第一件事就是将字符串“.svn”放入.gitignore
。我的工作方式是,git 的 master 分支与 SVN 同步(通过手动 ups 和 cis)。我的队友正在主 SVN 主干上进行开发,而我经常将他们的工作拉到 SVN 工作目录并将其提交给我本地的 git master。
我有一个 git 开发分支,用于我正在为未来版本开发的功能。我可以将其签出到工作目录中,进行本地开发,合并从 git master 分支中新拉取的 SVN 内容等。如果我需要对当前版本进行任何修补程序更改,我可以签回 git master,进行这些更改,在 git 上提交它们,在 SVN 上提交它们,一切都保持干净。
I've had surprising success initing and running a git repo right IN a svn working directory. So, I check out from SVN to a directory,
cd
into it, dogit init
, and very first thing put the string ".svn" into.gitignore
.The way I'm working, git's master branch is in sync with SVN (via manual ups and cis). My teammates are developing on the main SVN trunk, and I'm frequently pulling down their work to the SVN working directory and committing that to my local git master.
I have a git development branch for the feature I'm working on for a future release. I can check that out into the working directory, develop locally, merge newly-pulled SVN stuff from my git master branch, etc. If I have any hotfix changes that need to be made on the current version, I can check back out to git master, make those changes, commit them on git, commit them on SVN, and everything stays clean.
如果您的 svn 存储库包含标签和分支,您可以考虑使用 git svn 导入您的 svn 存储库到 git 仓库。无论如何,保留项目的历史记录也是很棒的。
git svn 克隆 -s svn_url dir_for_git
If your svn repo contains tags and branches you could consider using git svn to import your svn repo to a git repo. In any case it's also great to keep the history of your project.
git svn clone -s svn_url dir_for_git