Git /

How to manage branching with Git

1. Creating branches starting at a tag

This will create a branch using the 0.29.6 tag as a start:

   git branch stable-0.29 0.29.6

2. Switching between branches

   git checkout stable-0.29

will make it so the sources in your repo will be the stable-0.29

   git checkout master

will return to the master.

3. Add paches already in the Git master branch

   git cherry-pick -x f03ffce29627b15a938ba6f0145dc93fb93f6d83

will take the patch f03ffce29627b15a938ba6f0145dc93fb93f6d83 and try to merge it. If it fails, edit the failed file, then do:

   git commit -i path/to/file.php

to commit your merge resolved.

4. Pushing the branch to the public Git

Edit your .git/remotes/public, and add a second Push: line like this:

   Push: stable-0.29

5. Get a branch from a public repository

Do it like this:

    git checkout -b stable-0.29 origin/stable-0.29

Then the following command will show on what branch you will be working with:

   git branch
Page last modified on August 24, 2008, at 03:42 PM EST