0 Replies Latest reply on Feb 28, 2012 10:04 AM by Randall Hauch

    Branch changes in Git

    Randall Hauch Master

      We're now at a point where all major development is being done on the 3.0 codebase, and it's time to do a little branch cleanup in our Git repository. We've made a few changes in the official Git repository on GitHub:

       

      1. The 'master' branch has been renamed to '2.8.x'. This is where any fixes for 2.8.0.Final will be made.
      2. The '3.x' branch has been renamed to 'master', and this is the branch we should all be using for 3.0 development.

       

      If you have a local Git repository for development or building, there are several steps you want to perform to get your local repo in sync with the official one. Make sure you don't have any changes:

       

      $ git status
      # On branch master
      nothing to commit (working directory clean)
      

       

      If that's not the case, commit your changes to a branch or stash your changes.

       

      Once your working area is clean, please run these steps in order:

       

      $ git checkout master
      $ git fetch upstream
      $ git fetch --tags upstream
      $ git reset --hard upstream/master
      

       

      Lines 2 and 3 fetch all the history from the upstream (official)repository, and line 4 points the 'master' branch at the correct commit. At this point, 'master' should be the new 3.0 codebase, and the '2.8.x' remote branch has the older 2.x codebase. Remember that all commit IDs are unchanged and that we're just changing what the named branches are pointing to. You should be ready to go.

       

      However, if you have a local '3.x' branch, you might want to go ahead and delete it (since 'master' is now the same thing):

       

      $ git branch -rd upstream/3.x
      $ git branch -rd origin/3.x
      

       

      If those don't work, try just a normal delete (without the -r):

       

      $ git branch -d 3.x
      

       

      If you want to update the 'master' branch in your fork repository, you'll need to push with the '--force' option (since the history of 'master' has effectively changed):

       

      $ git push --force origin master
      

       

      Now, if you plan on working on the '2.8' codebase, go ahead and create a tracking branch that you can use to create topic-branches:

       

      $ git branch --set-upstream 2.8.x upstream/2.8.x
      

       

       

       

      If you have any problems, please let us know. Reply here, or (better yet) hop on IRC so we can help you out more quickly.