2017-12-27 435 views
1

我是一名开发人员,并且第一次将我的整个SVN存储库迁移到GIT存储库。作为一个POC,我已经迁移了当前的开发分支。移民在历史上也取得了成功。 问题:GIT中的SVN提交历史记录 迁移结果:当前SVN的所有分支历史记录都是从SVN迁移过来的,但是从SVN中创建该分支的日期开始。 我的期望:每个单独文件的历史以及完整的历史和相关的代码更改。来自SVN的所有提交历史记录都没有迁移到GIT

例如:我的根存储库是“MyProject”。每个版本都有单独的代码仓库,比如“MyDevRepo-rel-1.0”等等......我有一个文件“Helloworld.java”,它是在自发布1.0以来一直在处理的“MyDevRepo-rel-1.0”中创建的直到目前的版本,说它是“MyDevRepo-rel-5.0”。 现在,当我迁移“MyDevRepo-rel-5.0”时,我只有文件HelloWorld.java的当前分支提交历史记录,但不是从发行版1.0开始的

任何人都可以帮忙。

+0

请您提供明确的问题陈述?我还想邀请你学习SVN和git之间的区别。 – evolutionxbox

+0

MyDevRepo-rel-1.0,MyDevRepo-rel-5.0等是MyProject下的子文件夹吗?如果它们是子文件夹,那么文件Helloworld.java位于何处?如果修订版本1.0已经迁移到git repo,那么修订版本中的所有文件都应该正确查看,除非文件Helloworld.java没有提交到版本1.0中。你可以仔细检查svn日志来检查哪个版本提交文件'Helloworld.java'。 –

+0

1.MyDevRepo-rel-1.0,MyDevRepo-rel-5.0等是MyProject.2的子文件夹.HelloWorld.java最初是在MyDevRepo-rel1.0中创建的。 3.对于每个发布开发周期,MyDevRepo-rel-1.0是第一个,MydevRepo-rel-5.0是第5个发布版本.HelloWorld.java在发布1.0到5.0之间有自己的提交历史记录。假设HelloWorld.java文件有10个提交,直到5.0和5提交到5.0。当我迁移5.0回购时,我获得了5次提交历史,但我的期望是获得所有15次提交历史记录(从rel 5.0开始的10到5.0 + 5)。我的期望是否正确,如果不是,请提出建议做什么。 – Venkata

回答

-1
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. 
相关问题