Last active
March 3, 2021 12:49
-
-
Save aamine/5284633 to your computer and use it in GitHub Desktop.
How to migrate Subversion repository into GitHub with all history, all branches, all tags, using standard layout and temporary bare git repository.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. Write Authors.txt, which maps Subversion user ID to Git user. | |
For example: | |
taro = Taro Yamada <[email protected]> | |
2. Create temporary, local, bare Git repository and map Subversion branches and tags. | |
$ git --bare init proj.git | |
$ cd proj.git | |
$ cat <<. >> config | |
[svn-remote "svn"] | |
url = <Your Subversion Repository URL here> | |
fetch = trunk:refs/heads/master | |
branches = branches/*:refs/heads/* | |
tags = tags/*:refs/tags/* | |
. | |
$ git --bare svn fetch -A ../Authors.txt # Takes long... | |
3. Push all contents to GitHub | |
$ git --bare remote add origin https://github.com/your_account/your_project.git | |
$ git config branch.master.remote origin | |
$ git config branch.master.merge refs/heads/master | |
$ git push -u origin master | |
$ git push --all | |
$ git push --tags |
Hi all,
You do not need to create Authors.txt manually, rather you can get the list of all authors who have committed in the svn repo as:
svn log -q | awk -F '|' '/^r/ {sub("^ ", "", $2); sub(" $", "", $2); print $2" = "$2" <"$2">"}' | sort -u > Authors.txt
Hope it will help!
Thanks
Dharmender
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Format of the Authors.txt has to be as below:
svn_user_name = JustNameInGit [email protected]