Skip to content

Contributions Workflow

rcody edited this page Sep 30, 2019 · 2 revisions

This article describes a work-flow for contributing to this project.

Initial Setup

The steps below are a prerequisite for being able to contribute to this project.

  1. Fork the https://github.com/ThreatConnect-Inc/threatconnect-playbooks repo. (For instructions on how to fork a repo, please visit https://guides.github.com/activities/forking/)

  2. Clone the fork to your local computer.

  3. Run the following command to setup a remote that points to the upstream repo:

    git remote add upstream https://github.com/ThreatConnect-Inc/threatconnect-playbooks.git
    

    This will help us later when we need to update our fork with any changes that are made to the upstream repo (the one at https://github.com/ThreatConnect-Inc/threatconnect-playbooks). You can read more on this subject here.

Adding a New Playbook, Component, or App

Before walking through a step-by-step process for making a contribution, here is an important principle:

  • Do not make changes to the master branch. If you have something to contribute, you need to make changes on another branch (there are instructions for doing this below). You should always keep the master branch clean in the sense that the master branch of your fork should be the same as the master branch of the upstream repo (the one at https://github.com/ThreatConnect-Inc/threatconnect-playbooks).

Now, let's get to the good stuff. Here is the process for making a contribution that you should follow every time you want to make a contribution:

  1. Before making any changes, you need to make sure you fork is up to date with the upstream repo. To do this, run the commands below (which are documented here):

    # pull any changes from https://github.com/ThreatConnect-Inc/threatconnect-playbooks
    git fetch upstream
    
    # checkout the master branch of your fork
    git checkout master
    
    # merge any changes
    git merge upstream/master
    
    # push the changes (OPTIONAL)
    git push
    
  2. Now that the master branch of our fork is up to date with the upstream repo, create a branch for your contribution:

    git checkout -b [name_of_your_new_branch]
    
  3. Make any updates you would like to contribute. Stage and commit these updates.

  4. Once you're done making updates, push them to a branch of your fork on github:

    git push origin [name_of_your_new_branch]
    
  5. Finally, make a pull request from the branch of your fork on which you made the changes to the master branch of the upstream repo.

You're done! Your contribution has been received and the pull request can be reviewed.

Additional, Helpful Commands

To view all of the branches you have in a repo, use the command: git branch.

Clone this wiki locally