|Version 2 (modified by melo, 6 years ago)|
We are also experimenting with git-svn. If all works well, we might change the main repo to git in the future. Please consider this page as work in progress, and a sort of notebook for what has worked for us.
Cloning the Subversion repo into a git repo
First you need to create a new git repository. It will contain all the branches, tags and the trunk of the Subversion repository.
git-svn init --trunk=svn://svn.softwarelivre.sapo.pt/sapo_msg_mac/trunk --branches=svn://svn.softwarelivre.sapo.pt/sapo_msg_mac/branches --tags=svn://svn.softwarelivre.sapo.pt/sapo_msg_mac/tags
Then, you need to fetch the entire history. This will take a while (last I tried it, about 30 minutes on a 4Mb ADSL).
After this steps, you'll have several branches in your git repository. use git-branch to see them all.
Starting to work
You won't work directly on any of the branches created by git-svn. To do some work, you'll use a branch:
git-checkout -b your_branch_name_here remote/trunk
This will create a branch names your_branch_name_here and it will setup your work area inside it. All the commits you do from then on, will be on that branch.
Updating from upstream
TODO: basically write about:
- git-stash upstream_update (this will store any pending commits in a temporary space);
- git-svn rebase (this will fetch and merge all the new revisions from svn; you might need to fix conflits, see git-rebase for more info);
- git-stash apply upstream_update
- git-stash clear upstream_update
Either git-svn dcommit if you have commit bit in SVN, or send patches by email. See git-???...
Info: comparing svn checkout with git repo
Executive summary: after the git-svn clone, the git repo is larger than the svn checkout. But if you run git-gc, the git repo shrinks a lot.
melo@MrTray:sapo_msg_mac $ du -hs * 56M git-repo 48M svn-repo melo@MrTray:sapo_msg_mac $ cd git-repo/ melo@MrTray:git-repo $ git-gc Generating pack... Counting objects: 138 Done counting 4636 objects. Deltifying 4636 objects... 100% (4636/4636) done Writing 4636 objects... 100% (4636/4636) done Total 4636 (delta 2418), reused 0 (delta 0) Pack pack-ae314b2b7beb3604ac25100880d73c92bf6becb8 created. Removing unused objects 100%... Done. melo@MrTray:git-repo $ cd .. melo@MrTray:sapo_msg_mac $ du -hs * 33M git-repo 48M svn-repo melo@MrTray:sapo_msg_mac $