# USING THE GIT REPOSITORY ## Setup your own public repository Your first step is to establish a public repository from which we can pull your work into the master repository. You have two options: use GitHub or other public site, or setup/use your own repository. While you can use a private repository and utilize ``git format-patch`` to submit patches, this is discouraged as it does not facilitate public peer review. ### Option 1: GitHub 1. Setup a GitHub account (http://github.com/), if you haven't yet 2. Fork the ZF2 repository (http://github.com/zendframework/zf2) 3. Clone your fork locally and enter it (use your own GitHub username in the statement below) ```sh % git clone git@github.com:/zf2.git % cd zf2 ``` 4. Add a remote to the canonical ZF repository, so you can keep your fork up-to-date: ```sh % git remote add zf2 https://github.com/zendframework/zf2.git % git fetch zf2 ``` ### Option 2: Personal Repository We assume you will use gitosis (http://git-scm.com/book/en/Git-on-the-Server-Gitosis) or gitolite (http://git-scm.com/book/en/Git-on-the-Server-Gitolite) to host your own repository. If you go this route, we will assume you have the knowledge to do so, or know where to obtain it. We will not assist you in setting up such a repository. 1. Create a new repository ```sh % git init ``` 2. Add an "origin" remote pointing to your gitosis/gitolite repo: ```sh % git remote add origin git://yourdomain/yourrepo.git ``` 3. Add a remote for the ZF repository and fetch it ```sh % git remote add zf2 https://github.com/zendframework/zf2.git % git fetch zf2 ``` 4. Create a new branch for the ZF repository (named "zf/master" here) ```sh % git checkout -b zf/master zf2/master ``` 5. Create your master branch off the ZF branch, and push to your repository ```sh % git checkout -b master % git push origin HEAD:master ``` ### Pre-Commit Hook (Optional) The ZF2 Travis-CI will confirm that code style standards are met by using ```php-cs-fixer``` (https://github.com/fabpot/PHP-CS-Fixer) during its build runs. To reduce the number of red Travis-CI builds, the following Git pre-commit hook can help catch code style issues before committing. Save it as ```.git/hooks/pre-commit```, and make sure it is executable. ```php #!/usr/bin/env php master ``` To send a pull request, you have two options. If using GitHub, you can do the pull request from there. Navigate to your repository, select the branch you just created, and then select the "Pull Request" button in the upper right. Select the user "zendframework" as the recipient. If using your own repository - or even if using GitHub - you can send an email indicating you have changes to pull: - Send to - In your message, specify: - The URL to your repository (e.g., `git://mwop.net/zf2.git`) - The branch containing the changes you want pulled (e.g., `zf9295`) - The nature of the changes (e.g., `implements Zend_Service_Twitter`, `fixes ZF-9295`, etc.) ### What branch to issue the pull request against? Which branch should you issue a pull request against? - For fixes against the stable release, issue the pull request against the "master" branch. - For new features, or fixes that introduce new elements to the public API (such as new public methods or properties), issue the pull request against the "develop" branch. ## Branch Cleanup As you might imagine, if you are a frequent contributor, you'll start to get a ton of branches both locally and on your remote. Once you know that your changes have been accepted to the master repository, we suggest doing some cleanup of these branches. - Local branch cleanup ```sh % git branch -d ``` - Remote branch removal ```sh % git push origin : ``` ## FEEDS AND EMAILS RSS feeds may be found at: `https://github.com/zendframework/zf2/commits/.atom` where <branch> is a branch in the repository. To subscribe to git email notifications, simply watch or fork the zf2 repository on GitHub. ## CONTRIBUTORS AND COMMITTERS Both Zend's internal Zend Framework team and the members of the Community Review team have push privileges to the ZF2 repository.