1 Reply Latest reply on Apr 22, 2010 9:16 AM by thomas.diesler

    Migration to Git

    thomas.diesler

      Folks,

       

      I published the JBoss OSGi umbrella project and some of its associates on http://github.com/jbosgi

       

      There are three objectives that motivated me to do so

       

      * Lower the entry barier to the jboss osgi code base

      * I frequently switch between home and office, which is more natural to Git

      * Foundation to establish a Hudson QA based commit policy (i.e. Hudson pulls and only commits to master if there is no regression)

       

      and last bu not least

       

      * I'm learning what Git is all about ;-)

       

      I also maintain git-svn mirrors so you should see the same content in SVN. I suggest we stick to SVN as our master src repository for the Beta8 release cycle, which we may want to retire at the end of it when there is a consensus to switch over to Git.

        • 1. Re: Migration to Git
          thomas.diesler

          After lots of research into finding the right workflow I came to the conclusion that it is impractical to keep SVN as the master. The reason is that

           

          git svn dcommit 
          

           

          alters your git commit message (i.e. it adds a git-svn-id), which generates a different SHA1. So you cannot pull changes from a git repo into a git-svn repo and expect both repos to stay in sync.

           

          An example:

           

          - David clones the jbosgi from github and does lots of great work on it
          - David asks Thomas to pull his changes in the git-svn master
          - Thomas does git-svn rebase to pickup the latest trunk changes from Ales, who also did great work
          - Thomas pulls in Davids changes the HEAD is at abc123...
          - Thomas does git-svn dcommit to commit Davids changes to SVN
          - git-svn does its work and puts the git-svn-id in every git commit msg
          - The git-svn HEAD is at def456...
          

           

          David's HEAD is not the same as the git-svn HEAD any more. the two repo's have diverged and Thomas cannot pull David's next changes any more. The only way (I know of) Thomas can fix this, is to ask David to do a hard reset to the branch point where he started his work (i.e. to the last commit that contains a git-svn-id). After the reset David needs to rebase his repo to get in sync with the git-svn repo. This effectivly pulls in his own changes plus the ones that Ales did.

           

          In short, this is a nightmare and I abandoned the idea to keep the github HEAD in sync with the git-svn head. BobMcWirther also mirrors some jboss projects on Github. the commits however only flow from SVN to github and not vice versa. If you know a workflow that works bidirectionally, pleases let me know.

           

          To avoid confusion I removed  SVN trunk from all projects that have already been migrated to Github. At the end of Beta8 we can decide whether we want to stay with Git.

           

          Folks who prefer to work with SVN can do so in an SVN branch that they copy from the latest tag. I'll pull the changes into the GitHub master when needed.