A Simple Workflow for Collaborating via GitHub

Kristine Du
2 min readMar 31, 2020

Working with a partner or in a group on a project is great practice for using Git and GitHub. As GitHub is widely used for collaborating on open source projects and within companies, I’d recommend getting familiar with it as soon as possible. Check out my post on Git and GitHub for Beginners for an intro to some basic terminology and useful Git commands.

Getting Started with Collaboration

Make sure you have git installed and that you have created an account on GitHub.

Starting your own project:

  1. Initiate git to create a local repository within the project directory using git init
  2. Create a new repository on GitHub
  3. Link the remote repository on GitHub to your local repository
  4. Add Contributors to repository via Settings
  5. Collaborators should clone the repo to their create a local repository using git clone repo-link.git

Doing work & updating GitHub

Once you’ve got your local repository open, start with these steps to begin working on the project:

  1. Create and start working on a local branch — git checkout -b branch-name
  2. Make changes in working directory
  3. Add changes to staging — git add .
  4. Commit changes git commit -m "Write changes here."
  5. Push changes to GitHub branch — git push origin HEAD
  6. Create Pull Request to merge commit(s) to the main branch
  7. Another collaborator reviews, resolves conflicts (if any), and merges PR
  8. Switch to local main branch git checkout main
  9. Pull down main changes from GitHub to local git pull origin main
  10. Delete branch on GitHub & local if desired.

Repeat these steps as many times as necessary. Steps 2–4 can also be repeated in its own loop as it is important to commit often when you have working code. This will allow you to be descriptive in the changes that you’ve made and revert back to previous commits of working code if ever needed.

This is a great resource that was passed on to me to help beginners make their first contribution to an open source project on GitHub: https://github.com/firstcontributions/first-contributions

--

--

Kristine Du

Budding Software Engineer, former Project Manager, and amateur Pole Dancer in Denver, CO