Skip to content

Git Workflow

Grant Holland edited this page Feb 11, 2021 · 6 revisions

This page will describe how to use Git to effectively contribute to this project. It will consist of fetching others' changes, pushing your own changes, and working with branches.

Fetching External Changes

Whenever you are working on the project and want to see if anyone else has added something, just run git pull. This will automatically fetch and merge in changes from the NGCP/HEX repo, keeping your local copy up-to-date. If you run into any merge conflicts as a result of this command, navigate to this guide, scroll down to the section titled "Basic Merge Conflicts", and follow the instructions there.

Integrating Your Work

If you have written some code that fixes an issue, or just have general changes you would like to be accessible to others, then follow this process:

  1. Run git push myfork branchname, where branchname is the branch with changes you would like to send. This will send your commits up to the forked GitHub repository you have in your GitHub account
  2. Navigate to the pull requests page for the NGCP/HEX repo: https://github.com/NGCP/HEX/pulls
  3. Click on the green button labeled "New pull request" on the right side of the screen
  4. Click on the small blue link labeled "compare across forks" that is embedded in some text near the top of the screen
  5. Select "NGCP/HEX" as the base repository and "username/HEX" as the head repository, where "username" is your GitHub account username
  6. Select the branch that contains your new work as the compare branch, and select the same branch as the base branch
  7. Click on the green button labeled "Create pull request" on the right side of the screen
  8. Fill out the pull request by giving it a short descriptive title and describing what you've changed, any testing you did, and any issues the pull request will fix
  9. Click on the green button labeled "Create pull request". This will officially submit the pull request to the NGCP/HEX repo for others to view
  10. Add Matthew as a reviewer by going to the "Reviewers" tab of the pull request on the upper right and searching for his name (GitHub username "matthewlewis112")

Working With Branches

Most small changes should be done on the main branch of your local repo, and then pushed to the main branch of the NGCP repo. If you are working on a larger component, feel free to create your own branch to work on.