My remotes folder in the repository that git svn clone creates actually looks like: Six years later, and on git 2.9.3, some problems I experience with this guide: Since I had 141 svn repositories that needed to be converted, I wrote a set of wrapper scripts to ease the work… which I’ll discuss in my next blog post. You’re going to need a drink (or several). If, on the other hand, you’ve got a bunch of Subversion repositories to convert, you’ve got a long, long night in front of you if you want to convert them all by hand. Just take your “new-bare.git” folder and share it. If you’ve got just the one Subversion repo to convert…Congratulations! You’re done. :-) But, don’t worry your unix shell will provide a > secondary prompt for the extra-long command that starts with git for-each-ref. Git for-each-ref -format='%(refname)' refs/heads/tags | You’ll want to convert all those branches into actual Git tags using: Git-svn makes all of Subversions tags into very-short branches in Git of the form “tags/name”. You’ll want to rename it to Git’s standard “master” branch using: Your main development branch will be named “trunk” which matches the name it was in Subversion. You can now safely delete the ~/temp repository. Git config 'refs/remotes/*:refs/heads/*' Then push the temp repository to the new bare repository. Push repository to a bare git repositoryįirst, create a bare repository and make its default branch match svn’s “trunk” branch name. Git commit -m 'Convert svn:ignore properties to. If your svn repo was using svn:ignore properties, you can easily convert this to a. This will do the standard git-svn transformation (using the authors-transform.txt file you created in step 1) and place the git repository in the “~/temp” folder inside your home directory. Git svn clone -no-metadata -A authors-transform.txt -stdlayout ~/temp Clone the Subversion repository using git-svn Into this: jwilkins = John Albin Wilkins 2. For example, convert: jwilkins = jwilkins That will grab all the log messages, pluck out the usernames, eliminate any duplicate usernames, sort the usernames and place them into a “authors-transform.txt” file. Svn log -q | awk -F '|' '/^r/ ' | sort -u > authors-transform.txt This list can be used by git-svn to transform plain svn usernames into proper Git committers.įrom the root of your local Subversion checkout, run this command: But with a little bit of work, you can create a list of all SVN users and what their corresponding Git name and emails are. By default the git-svn tool will just list the SVN username in both the author and email fields. Git’s commits have much richer data, but at its simplest, the commit author needs to have a name and email listed. Subversion simply lists the username for each commit. Retrieve a list of all Subversion committers They are the recommended format for shared repositories. Bare repositories are ones without a local working checkout of the files available for modifications. Our goal is to do a complete conversion of our Subversion repository and end up with a bare Git repository acceptable for sharing with others (privately or publicly). So here it is, ponies and all… A complete guide to git-svn conversions Unfortunately, after reading the git-svn docs carefully and several useful resources (like the slightly-obscure Git FAQ, the Git Community Book, Paul Dowman’s blog and Alexis Midon’s blog), it became apparent that all the resources are piecemeal and nothing gives you the BIG HONKIN’ PICTURE. Supposedly, git-svn can also be used to convert a Subversion repo to Git. That worked great as a stop-gap measure, but now I’m ready to chuck all my svn repos and convert them to Git. When getting my toes wet in Git, I started using an extremely useful git command called git-svn, which primarily can be used to checkout a Subversion repository to a local Git repo and then push your changes back to the original Subversion repository. Since then I've started learning and researching the best ways to convert all my development to a Git-based workflow. This past year, it became obvious that there were many Git users within the Drupal community, so Drupal has decided to move to Git. (No, really.) Subversion was nearing 1.0, so I waited for its release and then used it everywhere. When I first realized that I needed a version control system, the best system at the time was CVS.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |