2017-12-27 517 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. 
相關問題