Skip to content

Instantly share code, notes, and snippets.

@viniciusvts
Last active November 10, 2023 18:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save viniciusvts/341ea89032af5ac31046bd3e5e609fc7 to your computer and use it in GitHub Desktop.
Save viniciusvts/341ea89032af5ac31046bd3e5e609fc7 to your computer and use it in GitHub Desktop.

Create a file with the authors

Enter in your local svn repo and execute the following command, this creates a users.txt file

svn log -q | awk -F '|' '/^r/ {gsub(/ /, "", $2); sub(" $", "", $2); print $2" = "$2" <"$2">"}' | sort -u > users.txt

An filled line example:

admin.svn = Admin Svn <admin.svn@email.com>

Init a git repository

Go to a path and init a git repository:

git svn init <repo_url> --no-metadata

Config the authors

git config svn.authorsfile <authors_file_created>

Config the branchs (optional)

If you desire, config the branchs you want adding the line in ".git/config" file:

In this example, clone branches that match with "feature*":

branches = branches/feature*:refs/heads/*

Fetch

This take several hours depending size of repository

git svn fetch

All in one command:

After users file created, clone the repository with the following command, this command works in a subdiretory for me:

git svn clone <repository_path> --trunk=. -A <authors_file_created> <local_folder_to_create_the_new_repo>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment