Skip to content

Project Workflow in Git and GitHub

andrzejp edited this page Dec 15, 2017 · 6 revisions

Initial setup

  1. Fork this repository onto your own GitHub account.
  2. Open Git Bash.
  3. Change the current working directory to your local project.
  4. Clone the repository you have forked.
  5. Add the original repo as upstream with the following command in the terminal. git remote add upstream https://github.com/chingu-voyage3/toucans-20.git

Workflow

The upstream will have a master branch and a development branch

Run git status regularly to see if your local master is up to date. If not, follow the below steps to keep local master always up to date with upstream/master.

  1. Check out master.
    git checkout master
  2. Pull the master branch from the upstream repository. git pull upstream master
  3. Commit the merge.

Work on your feature one personal branch. You can name this anything you want. Do not work on your local master branch, because it will make it more difficult to keep your local in sync with the remote.

To create a branch run git checkout -b YOUR-CHOSEN-BRANCH-NAME

When you're ready with your feature and it works on your local:

  1. Fetch the development branch from the origin master.
    git fetch upstream development
  2. Merge it into your feature branch locally. If there are conflicts, resolve them.
    git merge YOUR-BRANCH-NAME upstream/development
  3. Make sure your master is up to date.
  4. Push local master and YOUR-BRANCH-NAME feature branch into your fork.
    git push origin master
    git push origin YOUR-BRANCH-NAME
  5. Create a pull request to pull onto the chingu-voyage3/toucans-20 development branch from the YOUR-BRANCH-NAME in your Fork. Fix any issues - there shouldn't be any because you fixed all conflicts locally, but in the event that someone already made changes to the branch while you were doing the above steps, you can review the changes and merge solve the conflict in GitHub. We'll cross this bridge when we get to it. Approve the request yourself if there are no issues.
  6. Request to pull the chingu-voyage3/toucans-20 development branch into the master branch. Let this request be reviewed by team members.

BOOM

Clone this wiki locally