首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >来自SVN的所有提交历史记录不会迁移到GIT。

来自SVN的所有提交历史记录不会迁移到GIT。
EN

Stack Overflow用户
提问于 2017-12-27 21:07:21
回答 1查看 521关注 0票数 1

我是一名开发人员,这是我第一次将我的整个SVN存储库迁移到GIT存储库。作为一名POC,我迁移了当前的开发分支。迁移在历史上也是成功的。问题: SVN在GIT中提交历史迁移结果:迁移SVN当前开发分支的所有历史记录,但从SVN中创建此分支之日起。我的期望是:每个单独文件的历史,以及它的完整历史和相关的代码更改。

例如:我的根存储库是"MyProject“。我对每个版本都有单独的代码库,比如"MyDevRepo-rel-1.0“等等。我有一个"Helloworld.java“文件,它是在"MyDevRepo-rel- 1.0”中创建的,我从1.0版本一直到现在的版本都在做这个文件,就是"MyDevRepo-rel-5.0“。现在,当我迁移"MyDevRepo-rel-5.0“时,我只获得了文件HelloWorld.java的当前分支提交历史,而不是从1.0版开始

有谁能帮上忙吗。

EN

回答 1

Stack Overflow用户

发布于 2018-01-16 15:41:32

代码语言:javascript
复制
Thanks all for responding to my doubts. I am able to resolve this issue and 
the set of commands follow.

My requirement is : MIGRATE EXISTING SVN repository to GIT with all the commit 
history.


md mydirectory
cd mydirectory
git svn init  <SVN_ROOT_URL>
git config --global user.name "MY NAME"
git config --global user.email "MY EMAIL"
git config svn.authorsfile authors.txt
git svn fetch
git svn show-ignore >> .gitignore
git remote -v (to check the remote branches)
git remote add origin <MY_GIT_REPO>.git
git add .
git commit -m "migrating svn to git"
git push -u origin master (this will push your local repo to the git server)
git svn rebase (this command will sync the latest changes from svn to the current git repo)
git push (this command pushes all the latest code checked-out code from SVN to GIT).

Mistake I made : I migrated one individual branch and expected all the 
commit history right from the inception of every file. 

Learnings : If I want all the commit history of every individual file, then 
I had to migrate the entire SVN repository from the root. This resolved my 
problem.
Please add if there are any missing things.
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/47992762

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档