Skip to content

Contribution Guidelines

Steve Popoola edited this page Mar 15, 2017 · 11 revisions

Fork-Branch Git Workflow

  1. Fork the repository [https://github.com/johnnymast/myio.git]

  2. Clone the repository to your local system.

    git clone [https://github.com/stevepop/myio.git]

    Make sure you are cloning your forked repository not the original one!

  3. Add a git remote to the original repository. When cloning your forked branch, GIT will add a remote called origin which points to your forked branch.

    You need to add another remote to connect to the original repository. This is necessary for you to be able to keep your local branch in sync with the original repository branch.

    git remote add upstream [https://github.com/johnnymast/myio.git]

    Make sure you run git remote -v to confirm that you can see both remotes;


    sites/myio [new-design*» git remote -v

    `origin	https://github.com/stevepop/myio (fetch)`
    `origin	https://github.com/stevepop/myio (push)`
    `upstream	https://github.com/johnnymast/myio (fetch)`
    `upstream	https://github.com/johnnymast/myio (push)`
    
  4. Create a feature branch in which to place changes When you want to start working, you will need to create a new feature branch named appropriately so other devs can understand what you are working on. To create a new branch and check it out;


    git checkout -b <new branch name>

    Example; git checkout -b setup-general-layout

  5. Make changes and commit to the branch When you are done with changes, you will add your new changes files with git add and commit with git commit

  6. Push the branch to Github One you have finished with the feature, you push your changes;

    git push origin new-feature-branch

    Note that you are at this point pushing this changes to the origin remote, which is your own forked remote branch.

  7. Submitting a Pull request


    First fetch from upstream to obtain changes that have been made to the main repository and merge with your own master branch.

    git fetch upstreamgit checkout master git merge upstream/master

if there were any new commits, rebase your development branch. git checkout newfeature git rebase master 
Open a pull request from the new branch to the original repo.


    Ensure that you select a reviewer from the right navigation before submitting or else your Pull request will be declined automatically by Github.

  8. Cleanup after your pull request is merged

    git pull upstream master

    This pulls the changes from the original repository’s master branch (upstream) to your local cloned repository. If you are happy with the changes, you can then proceed to delete the feature branch.
 git branch -d <branch name>

    Then update the master branch in your forked repository.

    git push origin master

    You can then push the deletion of the feature branch the Github repository.

    git push --delete origin <branch name>

  9. Keep your forked branch in Sync Your forked branch does not automatically sync with the original repository so you will need to update regularly.

    git pull upstream master

    git push origin master

Clone this wiki locally