Contribution

General contribution flow

Pull requests (PRs) are the best ways to propose changes to a project repository. At Layer5 org, we use the Github Flow:

Clone your fork to your local machine

  • Fork the repository you are working on.
  • Go to your GitHub account, open the forked repository, click on the code button and then click the “copy to clipboard” icon if you intend to use a command-line tool.
  • Open the terminal and run the following git command:
    1git clone “URL you copied from the clipboard.”

Add 'upstream' repo to list of remotes

  • Keeping your fork up to date while this isn't a necessary step. If you plan on doing anything more than a tiny quick fix, you'll want to make sure you keep your fork up to date by tracking the original "upstream" repo that you forked earlier.
  • To do this, you'll need to add a remote. An example of the command is given below:
    1git remote add upstream https://github.com/layer5io/meshery.git
    Here “meshery" is used as the example repo. Be sure to reference the actual repo you are contributing to.

Create and checkout a new branch

  • Whenever you begin to work on a new feature or bugfix, it's important that you create a new branch. Not only is it a proper git workflow, but it also keeps your changes organized and separated from the master branch so that you can easily submit and manage multiple pull requests for every task completed.
  • Perform the flow:
    1 git checkout -b your-new-branch-name
    For example,
    1git checkout -b feature
    (feature being a branch name)

Make the necessary changes to your file.

  • To add the changes you have made to your branch, use:
    1git add <file>
  • If you add multiple file changes to the branch, you simply use:
    1 git add .

Commit the changes made

  • Now commit those changes using the git commit command:
    1git commit -s -m “This is my commit message”

Push changes to Github and submit a pull request (PR)

  • To push your changes, run the git command:
    1git push origin your_branch_name

Make sure to Sign-off on your Commits (Developer Certificate of Origin)

To contribute to this project, you must agree to the Developer Certificate of Origin (DCO) for each commit you make. The DCO is a simple statement that you, as a contributor, have the legal right to contribute.

To signify that you agree to the DCO for contributions, you simply add a line to each of your git commit messages:

1Signed-off-by: Jane Smith <jane.smith@example.com>

In most cases, you can add this signoff to your commit automatically with the -s or --signoff flag to git commit. You must use your real name and a reachable email address (sorry, no pseudonyms or anonymous contributions). An example of signing off on a commit:

1$ commit -s -m “my commit message w/signoff”

To ensure all your commits are signed, you may choose to add this alias to your global .gitconfig:

1[alias] amend = commit -s --amend cm = commit -s -m commit = commit -s
2

Or you may configure your IDE, for example, Visual Studio Code to automatically sign-off commits for you:

Layer5, the cloud native management company

An empowerer of engineers, Layer5 helps you extract more value from your infrastructure. Creator and maintainer of service mesh standards. Maker of Meshery, the cloud native management plane.