Migrating to GIT SVN source

Disclaimer: This article is a blogger original article, follow the CC 4.0 BY-SA copyright agreement, reproduced, please attach the original source link and this statement.
This link: https://blog.csdn.net/Hanoch_wang/article/details/98240974

Today department received a mandate to take a svn project to migrate to git up, for me this rookie it is quite uncomfortable. Because I learned a half-git, svn and there is no contact, but no way, have to bite the bullet on the ah.

It took an hour to check in online tutorials on a variety of svn, then simple to understand the differences between svn and git, thanks to big brother gave me a help document, very grateful begin migration.

First, we need to know svn link project, assuming the project path to svn: // practice. While ensuring that you want to migrate git project has been created, not create one myself, it is assumed here git repository address is http: //test.git.

Execute the following command in your chosen local warehouse, assuming the name of a local warehouse called gittest.

git svn clone svn://practice --authors-file=authors.txt --no-metadata  gittest

About --authors-file = authors.txt and --no-metadata may refer to the following links https://git-scm.com/book/zh/v2/Git- with other systems - to migrate to -git .

Gittest into the directory, then the refs/remotesnext movement of the remaining reference local branch:

rm -Rf .git/refs/remotes

Now all the old branches are real Git branches and all the old tags are real Git tags. The last thing to do is to add your new Git server as a remote and pushed to the top. The following is an added your server is an example of a remote repository:

$ git remote add origin http://test.git

Because you want to upload all branches and tags, you can now run:

$ git push origin --all

This, because your project has been uploaded to the git up.

But there are still some problems, due to the non-standard development process, code line code on some original svn inconsistent, git go after the release process must ensure that the code is consistent with the line of code on git, then you can pull take line of code re-upload git repository, as follows:
I just want to go and py script, not like some other unrelated log files, and all files tmp directory, I do not want it to appear in the project. I just started using the following command line package codes:
 

sudo find /data/test -path "/data/test/tmp"  -prune -o -name "*.py"  -o -name "*.go" | xargs tar  -czvPf  gittest.tar.gz

For details on this command can refer https://blog.csdn.net/u011517841/article/details/53204524 , -path display all files except the current directory, if / data / test / tmp exists, -prune

Guess you like

Origin blog.csdn.net/Hanoch_wang/article/details/98240974
Recommended