简体   繁体   English

SVN中的所有提交历史记录都不会迁移到GIT

[英]All the commit history from SVN is not migrated to GIT

I am a developer and for the first time , I am migrating my whole SVN repository to a GIT repository. 我是一名开发人员,这是我第一次将整个SVN信息库迁移到GIT信息库。 As a POC, I have migrated current development branch. 作为POC,我已经迁移了当前的开发分支。 Migration was successful with the history as well. 迁移在历史上也很成功。 Problem : SVN commit history in GIT Result of migration : All the history of current dev branch from SVN is migrated , but from the date this branch was created in SVN. 问题:GIT中的SVN提交历史记录迁移结果:迁移了SVN当前dev分支的所有历史记录,但是从SVN中创建该分支的日期开始。 My Expectation : History of every individual file along with its complete history and related code changes. 我的期望:每个文件的历史记录及其完整的历史记录和相关的代码更改。

Ex : My root repository is "MyProject". 例如:我的根存储库是“ MyProject”。 I have individual code repos for every release, like "MyDevRepo-rel-1.0" etc... I have a file "Helloworld.java" which was created in "MyDevRepo-rel-1.0" which I have been working on since release 1.0 till current release , say it be "MyDevRepo-rel-5.0". 对于每个发行版,我都有单独的代码存储库,例如“ MyDevRepo-rel-1.0”等。我有一个文件“ Helloworld.java”,该文件是在“ MyDevRepo-rel-1.0”中创建的,自1.0版以来就一直在使用直到当前版本,说它是“ MyDevRepo-rel-5.0”。 Now, when I migrated "MyDevRepo-rel-5.0" , I have got only current branch commit history for the file HelloWorld.java , but not from release 1.0 现在,当我迁移“ MyDevRepo-rel-5.0”时,我仅获得了文件HelloWorld.java的当前分支提交历史记录,而没有从1.0版开始

Can any one help on this. 谁能帮上忙。

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.

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

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