我是开发人员,我第一次将整个SVN存储库迁移到GIT存储库。作为POC,我已经迁移了当前的开发分支。移民在历史上也取得了成功。 问题:SVN在GIT中提交历史记录 迁移结果:迁移SVN当前dev分支的所有历史记录,但是从SVN创建此分支的日期开始。 我的期望:每个文件的历史记录及其完整的历史记录和相关的代码更改。
Ex:我的根存储库是“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版本的
任何人都可以为此提供帮助。
答案 0 :(得分:0)
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.