|
| 1 | +# Contributor - Simple Contribution Flow |
| 2 | +This article covers how to make a contribution on AsyncAPI. It walks you through the basic contribution flow and workflow processes you need to setup in order to make a contribution. |
| 3 | + |
| 4 | +## Contents |
| 5 | +- [Contributor - Simple Contribution Flow](#contributor---simple-contribution-flow) |
| 6 | + - [Contents](#contents) |
| 7 | + - [Making a contribution](#making-a-contribution) |
| 8 | + - [Setting up a workflow](#setting-up-a-workflow) |
| 9 | + - [Setting up the `master` branch](#setting-up-the-master-branch) |
| 10 | + - [Setting up a new branch](#setting-up-a-new-branch) |
| 11 | + - [Making a pull request](#making-a-pull-request) |
| 12 | + - [Making further commits](#making-further-commits) |
| 13 | + - [Additional Information](#additional-information) |
| 14 | + |
| 15 | +## Making a contribution |
| 16 | +You are welcome to making a contribution at AsyncAPI. We would love to get your suggestions, improvements, and ideas. You are encouraged to make quality contributions either by making a PR(Pull Request) for an already existing issue or creating an issue. To make a successful contribution, you are required to work on a forked repository and create a branch on the forked repository where you can make your changes(do not work directly on the `master` branch). |
| 17 | + |
| 18 | +## Setting up a workflow |
| 19 | +### Setting up the `master` branch |
| 20 | +- Fork the repository by clicking on the fork icon |
| 21 | +- Clone the forked repo in your local terminal |
| 22 | +```git clone <the link you copied>``` |
| 23 | +- Run ```git remote -v```. This will list the URLs of the remote repository for your fork. |
| 24 | +The result is as follows: |
| 25 | + ``` |
| 26 | + origin https://github.com/{your-username}/{your-fork}.git (fetch) |
| 27 | + origin https://github.com/{your-username}/{your-fork}.git (push) |
| 28 | + ``` |
| 29 | + |
| 30 | + See the example: |
| 31 | + ``` |
| 32 | + origin https://github.com/i000000/asyncapi.git (fetch) |
| 33 | + origin https://github.com/i000000/asyncapi.git (push) |
| 34 | + ``` |
| 35 | +- Run ```git remote add upstream https://github.com/{original-owner}/{original-repository}.git``` |
| 36 | + - This adds a new remote named `upstream` to your local repository. |
| 37 | + - The `upstream` name refers to the original repository while `origin` refers to the forked repository. |
| 38 | + - The `https://github.com/{original-owner}/{original-repository}.git` refers to the URL of the main repo. |
| 39 | + |
| 40 | + See the example: ```git remote add upstream https://github.com/asyncapi/asyncapi.git``` |
| 41 | + |
| 42 | +- Run ```git fetch upstream master``` to download the latest changes from the master branch of the upstream remote (the original repository you forked from). |
| 43 | +- Set up the local branch to track the remote branch from the upstream repo: ```git branch -u upstream/master master``` |
| 44 | +- Run ```git branch -vv``` to verify that your local `master` branch points to the `upstream/master` branch. |
| 45 | +The result is similar to the following: |
| 46 | +``` |
| 47 | +* master c2226e0 [upstream/master] Update the README.md document |
| 48 | +``` |
| 49 | + |
| 50 | +### Setting up a new branch |
| 51 | +Before you begin to make changes, create a new branch |
| 52 | +- Run `git checkout -b <branchname>` |
| 53 | + |
| 54 | +## Making a pull request |
| 55 | +After making contributions and you are set to make a PR. |
| 56 | + |
| 57 | +- Run `git add <file name>` if you created a new file as part of your changes and commit with a meaningful message. `git commit -m "Meaningful commit message"`. Else, commit your changes with `git commit -am "Meaningful commit message"`. |
| 58 | +- Push the changes |
| 59 | +``` |
| 60 | +git push --set-upstream origin <branchname> |
| 61 | +``` |
| 62 | +- Make a pull request and wait for the maintainers to review. |
| 63 | + |
| 64 | +## Making further commits |
| 65 | +Normally, when a maintainer requests changes on your PR, there may have been previous commits from other contributors on that repository. Before you begin to add those changes, make sure you sync your branches (both the master and custom branch you are using). |
| 66 | +After doing that, in your local machine terminal run `git pull` to download and merge the changes to your local machine then you can start making the changes. |
| 67 | + |
| 68 | +To make further commits on that same repository and branch. |
| 69 | +Simply run, |
| 70 | +- `git add <filename>` and `git commit -m "Meaningful commit message"` (if you created a new file). |
| 71 | +- But if you are making modifications, run `git commit -am "Meaningful commit message"`. |
| 72 | +- Run `git push` to push your changes. |
| 73 | + |
| 74 | +## Additional Information |
| 75 | +- [Git workflow document](https://github.com/asyncapi/community/blob/master/git-workflow.md) |
| 76 | +- [Conventional commit messages](https://github.com/asyncapi/website/blob/master/CONTRIBUTING.md) |
0 commit comments