home / guides / branch-strategy
##An approach to branching

This doc will serve as a guide for the use of branches in the repos.

####remote branches
- __master__: holds the latest stable development on the next release version
- __x.x__: holds the version numbers for each release which might be unstable before being merged into master(ie: 1.0) 
- __x.x-feature__: holds suggested changes on a particular feature

####local branches
For each branch that you plan to work on you should have a local copy.
use ```git checkout -b x.x origin/x.x``` 

Often you might find yourself needing to make specific configuration changes for your local installation.  In this case it is best to maintain a local copy of the branch. Let's analyze a quick use case. We will be using local.x.x to differentiate the copy of the remote.

first we want to create a local branch of master that will hold our ```local``` configuration.
 
- ```git checkout -b local origin/master```
- Make you local changes
- Commit to the ```local``` branch

Now you have a central place for the local configuration. You can use this to merge into the other version or feature branches once you have made ```local.<branch>```. So, lets look at setting up local.<branch>

- Create a copy of version x.x
 - ```git checkout -b x.x origin/x.x```
- Create the local.<branch> for you configuration
 - ```git checkout -b local.x.x```
- Merge in your configuration
 - ```git merge local```

If you are working on the version or feature you may need to make some changes that you want to push to the remote. To do this we want to switch back to the copy.

- Switch to the copy.
 - ```git checkout x.x```
- Commit your changes
 - ```git push origin x.x```
- Switch back to your local
 - ```git checkout local.x.x```

Sometimes you may be up late and mistakingly commit to your ```local.<branch>```. Now you need to cherry-pick.

- Find out what you committed
 - git log
- Switch to the copy
 - git checkout x.x
- Grab the commit
 - git cherry-pick ```<hash>```
- Switch back to your local   
 - ```git checkout local.x.x```