2Mar/100
Git Subtree Merge and git-svn
Issue: Git submodules do not play nicely with git-svn; git subtree merging is a more appropriate strategy for my specific use case.
Resolution: This is my recipe (borrowed heavily from the formal git documentation).
git checkout -b TRY-MERGE master
git remote add -f Bproject /path/to/B
git merge -s ours --no-commit Bproject/master
git read-tree --prefix=dir-B/ -u Bproject/master
git commit -m "Task - JIRA-001 - Merge B project as our subdirectory"
git checkout master
git merge TRY-MERGE master -m "Task - JIRA-001 - Merging subtrees into project."
git-svn dcommit
git remote add -f Bproject /path/to/B
git merge -s ours --no-commit Bproject/master
git read-tree --prefix=dir-B/ -u Bproject/master
git commit -m "Task - JIRA-001 - Merge B project as our subdirectory"
git checkout master
git merge TRY-MERGE master -m "Task - JIRA-001 - Merging subtrees into project."
git-svn dcommit
You may update your local copy from the remote at any time with:
git pull -s subtree Bproject master
Reference: http://kernel.org/pub/software/scm/git/docs/v1.7.0/howto/using-merge-subtree.html
26Feb/100
Commit a linear git history to subversion
Issue: I was recently asked to integrate my local development (which I had done under git management) into our central Subversion server. How to do this while preserving my commit history?
Resolution: After a lot of reading (and an upgrade to git-1.7.0) I found the following recipe to work for me.
git branch master.bak master
git-svn init svn://repo.domain.local/Project/trunk/sub/directory
git-svn fetch
git checkout -b svnrebase git-svn
git-svn rebase
git rebase --root --onto svnrebase master
git-svn dcommit
git-svn init svn://repo.domain.local/Project/trunk/sub/directory
git-svn fetch
git checkout -b svnrebase git-svn
git-svn rebase
git rebase --root --onto svnrebase master
git-svn dcommit