|
| 1 | +# Contributing |
| 2 | + |
| 3 | +So, you want to contribute to this project! That's awesome. However, before doing so, please read the following simple steps how to contribute. |
| 4 | +This will make the life easier and will avoid wasting time on things which are not requested. ✨ |
| 5 | + |
| 6 | +## Discuss the changes before doing them |
| 7 | + |
| 8 | + - First of all, open an issue in the repository, using the [bug tracker](https://github.com/the-1Riddle/Leetcode-c-Solutions/issues), |
| 9 | + describing the contribution you would like to make, the bug you found or any |
| 10 | + other ideas you have. This will help us to get you started on the right |
| 11 | + foot. |
| 12 | + |
| 13 | + - It is recommended to wait for feedback before continuing to next steps. |
| 14 | + However, if the issue is clear (e.g. a typo) and the fix is simple, you can |
| 15 | + continue and fix it. |
| 16 | + |
| 17 | +## Steps to follow |
| 18 | + |
| 19 | +<details> |
| 20 | +<summary> |
| 21 | +Step 1: Star The Repo (Optional) |
| 22 | +</summary> |
| 23 | +<br> |
| 24 | + |
| 25 | + - Star the repo by pressing the topmost-right button to start your wonderful journey |
| 26 | + |
| 27 | + |
| 28 | + |
| 29 | +</details> |
| 30 | + |
| 31 | +--- |
| 32 | + |
| 33 | +<details> |
| 34 | +<summary> |
| 35 | +Step 2: Fork this repo |
| 36 | +</summary> |
| 37 | +<br> |
| 38 | + |
| 39 | +- On the [GitHub page for this repository](https://github.com/the-1Riddle/Leetcode-c-Solutions), click on the Button ["**Fork**"](https://github.com/the-1Riddle/Leetcode-c-Solutions/fork). |
| 40 | + |
| 41 | + |
| 42 | + |
| 43 | +</details> |
| 44 | + |
| 45 | +--- |
| 46 | + |
| 47 | +<details> |
| 48 | +<summary> |
| 49 | +Step 3: Clone it |
| 50 | +</summary> |
| 51 | + |
| 52 | +- **Method 1:** GitHub Desktop |
| 53 | + |
| 54 | +> ⚠️ **NOTE:** If you're not familiar with Git, using **GitHub Desktop Application** is a better start. If you choose this method, make sure to download it before continuing reading. |
| 55 | +> |
| 56 | +> ❗❗ Access link to download [**here**](https://desktop.github.com). |
| 57 | +
|
| 58 | +- **Method 2:** Git |
| 59 | + |
| 60 | +Clone the forked repository. Open git bash and type: |
| 61 | + |
| 62 | +```bash |
| 63 | +git clone https://github.com/<your-github-username>/Leetcode-c-Solutions.git |
| 64 | +cd Leetcode-c-Solutions |
| 65 | +git config --global user.name "<your GitHub user name>" && git config --global user.email "your GitHub primary email" |
| 66 | +``` |
| 67 | + |
| 68 | +> This makes a local copy of the repository in your machine. |
| 69 | +> |
| 70 | +> ⚠️ **Replace \<your-github-username\>!** |
| 71 | +
|
| 72 | +Learn more about [forking](https://help.github.com/en/github/getting-started-with-github/fork-a-repo) and [cloning a repo](https://docs.github.com/en/github/creating-cloning-and-archiving-repositories/cloning-a-repository). |
| 73 | + |
| 74 | +</details> |
| 75 | + |
| 76 | +--- |
| 77 | + |
| 78 | +<details> |
| 79 | +<summary> |
| 80 | +Step 4: Create your feature branch |
| 81 | +</summary> |
| 82 | + |
| 83 | +Always keep your local copy of the repository updated with the original repository. |
| 84 | +Before making any changes and/or in an appropriate interval, follow the following steps: |
| 85 | + |
| 86 | +- **Method 1:** GitHub Desktop |
| 87 | + |
| 88 | +Learn more about how to create new branch [here](https://docs.github.com/en/desktop/contributing-and-collaborating-using-github-desktop/making-changes-in-a-branch/managing-branches#creating-a-branch) and how to fetch and pull origin from/to your local machine [here](https://docs.github.com/en/desktop/contributing-and-collaborating-using-github-desktop/keeping-your-local-repository-in-sync-with-github/syncing-your-branch). |
| 89 | + |
| 90 | +Learn more about how to fetch and pull origin from/to your local machine using **GitHub Desktop** [here](https://docs.github.com/en/desktop/contributing-and-collaborating-using-github-desktop/keeping-your-local-repository-in-sync-with-github/syncing-your-branch). |
| 91 | + |
| 92 | +- **Method 2:** Git |
| 93 | + |
| 94 | +Run the following commands **_carefully_** to update your local repository |
| 95 | + |
| 96 | +```sh |
| 97 | +# If you cloned a while ago, get the latest changes from upstream |
| 98 | +git checkout <master> |
| 99 | +git pull upstream <master> |
| 100 | + |
| 101 | +# Make a feature branch (Always check your current branch is up to date before creating a new branch from it to avoid merge conflicts) |
| 102 | +git checkout -b <branch-name> |
| 103 | + |
| 104 | +# |
| 105 | +``` |
| 106 | + |
| 107 | +</details> |
| 108 | + |
| 109 | +--- |
| 110 | + |
| 111 | +<details> |
| 112 | +<summary> |
| 113 | +Step 5: Ready, Set, Go... |
| 114 | +</summary> |
| 115 | + |
| 116 | +Once you have completed these steps, you are ready to start contributing to the project and creating **pull requests**. |
| 117 | + |
| 118 | +- Create a folder if you want to contribute solutions to a new programming language |
| 119 | + > The folder name **must** be the name of the language and the files **must** be the names of the questions. |
| 120 | +- Write your code and add to the respective folder in the projects directory, locally. |
| 121 | +- Don't forget to add a `README.md` in your folder. |
| 122 | + |
| 123 | +* **Method 1:** GitHub Desktop |
| 124 | + |
| 125 | +Learn more how to pull request from your local machine using **GitHub Desktop** to the main repo [here](https://docs.github.com/en/desktop/contributing-and-collaborating-using-github-desktop/working-with-your-remote-repository-on-github-or-github-enterprise/viewing-a-pull-request-in-github-desktop). |
| 126 | + |
| 127 | +- **Method 2:** Git |
| 128 | + |
| 129 | +Add the changes with `git add`, `git commit`: |
| 130 | + |
| 131 | +```bash |
| 132 | +git add -A |
| 133 | +git commit -m "<your message>" |
| 134 | +``` |
| 135 | + |
| 136 | +Push the code _to your repository_. |
| 137 | + |
| 138 | +```bash |
| 139 | +git push origin <branch-name> |
| 140 | +``` |
| 141 | + |
| 142 | +make sure you have no conflicts. 🙂 🙂 |
| 143 | + |
| 144 | +</details> |
| 145 | + |
| 146 | +--- |
| 147 | + |
| 148 | +<details> |
| 149 | +<summary> |
| 150 | +Step 6: Pull Request |
| 151 | +</summary> |
| 152 | + |
| 153 | +Go to the GitHub page of _your fork_, and **make a pull request**: |
| 154 | + |
| 155 | +Read more about pull requests on the [GitHub help pages](https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/creating-a-pull-request). |
| 156 | + |
| 157 | +- Now wait, until _your Pull Request_ is approved! If there are any conflicts, you will get a notification. |
| 158 | + |
| 159 | +</details> |
| 160 | + |
| 161 | +<br> |
| 162 | + |
| 163 | +## Wait for feedback |
| 164 | +Before accepting your contributions, we will review them. You may get feedback |
| 165 | +about what should be fixed in your modified code. If so, just keep committing |
| 166 | +in your branch and the pull request will be updated automatically. |
| 167 | + |
| 168 | +## Everyone is happy! 🤗 |
| 169 | +Finally, your contributions will be merged, and everyone will be happy! :smile: |
| 170 | +Contributions are more than welcome! |
| 171 | + |
| 172 | +Thanks! :sweat_smile: |
| 173 | + |
0 commit comments