...
1Contributing to Okta Open Source Repos
2======================================
3
4Sign the CLA
5------------
6
7If you haven't already, [sign the CLA](https://developer.okta.com/cla/). Common questions/answers are also listed on the CLA page.
8
9Summary
10-------
11This document covers how to contribute to an Okta Open Source project. These instructions assume you have a GitHub
12.com account, so if you don't have one you will have to create one. Your proposed code changes will be published to
13your own fork of the Okta JWT verifier for Golang project and you will submit a Pull Request for your changes to be added.
14
15_Lets get started!!!_
16
17
18Fork the code
19-------------
20
21In your browser, navigate to: [https://github.com/okta/okta-jwt-verifier-golang](https://github.com/okta/okta-jwt-verifier-golang)
22
23Fork the repository by clicking on the 'Fork' button on the top right hand side. The fork will happen and you will be taken to your own fork of the repository. Copy the Git repository URL by clicking on the clipboard next to the URL on the right hand side of the page under '**HTTPS** clone URL'. You will paste this URL when doing the following `git clone` command.
24
25On your computer, follow these steps to setup a local repository for working on the Okta JWT verifier for Golang:
26
27``` bash
28$ git clone https://github.com/YOUR_ACCOUNT/okta-jwt-verifier-golang.git
29$ cd okta-jwt-verifier-golang
30$ git remote add upstream https://github.com/okta/okta-jwt-verifier-golang.git
31$ git checkout develop
32$ git fetch upstream
33$ git rebase upstream/develop
34```
35
36
37Making changes
38--------------
39
40It is important that you create a new branch to make changes on and that you do not change the `develop`
41branch (other than to rebase in changes from `upstream/develop`). In this example I will assume you will be making
42your changes to a branch called `feature/myFeature`. This `feature/myFeature` branch will be created on your local repository and will be pushed to your forked repository on GitHub. Once this branch is on your fork you will create a Pull Request for the changes to be added to the Okta JWT verifier for Golang project.
43
44It is best practice to create a new branch each time you want to contribute to the project and only track the changes for that pull request in this branch.
45
46``` bash
47$ git checkout develop
48$ git checkout -b feature/myFeature
49 (make your changes)
50$ git status
51$ git add <files>
52$ git commit -m "descriptive commit message for your changes"
53```
54
55> The `-b` specifies that you want to create a new branch called `feature/myFeature`. You only specify `-b` the first time you checkout because you are creating a new branch. Once the `feature/myFeature` branch exists, you can later switch to it with only `git checkout feature/myFeature`.
56
57
58Rebase `feature/myFeature` to include updates from `upstream/develop`
59------------------------------------------------------------
60
61It is important that you maintain an up-to-date `develop` branch in your local repository. This is done by rebasing in
62 the code changes from `upstream/develop` (the official Okta JWT verifier for Golang repository) into your local repository.
63 You will want to do this before you start working on a feature as well as right before you submit your changes as a pull request. I recommend you do this process periodically while you work to make sure you are working off the most recent project code.
64
65This process will do the following:
66
671. Checkout your local `develop` branch
682. Synchronize your local `develop` branch with the `upstream/develop` so you have all the latest changes from the
69project
703. Rebase the latest project code into your `feature/myFeature` branch so it is up-to-date with the upstream code
71
72``` bash
73$ git checkout develop
74$ git fetch upstream
75$ git rebase upstream/develop
76$ git checkout feature/myFeature
77$ git rebase develop
78```
79
80> Now your `feature/myFeature` branch is up-to-date with all the code in `upstream/develop`.
81
82
83Make a GitHub Pull Request to contribute your changes
84-----------------------------------------------------
85
86When you are happy with your changes and you are ready to contribute them, you will create a Pull Request on GitHub to do so. This is done by pushing your local changes to your forked repository (default remote name is `origin`) and then initiating a pull request on GitHub.
87
88> **IMPORTANT:** Make sure you have rebased your `feature/myFeature` branch to include the latest code from `upstream/develop`
89_before_ you do this.
90
91``` bash
92$ git push origin feature/myFeature
93```
94
95Now that the `feature/myFeature` branch has been pushed to your GitHub repository, you can initiate the pull request.
96
97To initiate the pull request, do the following:
98
991. In your browser, navigate to your forked repository: [https://github.com/YOUR_ACCOUNT/okta-jwt-verifier-golang](https://github
100.com/YOUR_ACCOUNT/okta-jwt-verifier-golang)
1012. Click the new button called '**Compare & pull request**' that showed up just above the main area in your forked repository
1023. Validate the pull request will be into the upstream `develop` and will be from your `feature/myFeature` branch
1034. Enter a detailed description of the work you have done and then click '**Send pull request**'
104
105If you are requested to make modifications to your proposed changes, make the changes locally on your `feature/myFeature` branch, re-push the `feature/myFeature` branch to your fork. The existing pull request should automatically pick up the change and update accordingly.
106
107
108Cleaning up after a successful pull request
109-------------------------------------------
110
111Once the `feature/myFeature` branch has been committed into the `upstream/develop` branch, your local `feature/myFeature` branch and
112the `origin/feature/myFeature` branch are no longer needed. If you want to make additional changes, restart the process with a new branch.
113
114> **IMPORTANT:** Make sure that your changes are in `upstream/develop` before you delete your `feature/myFeature` and
115`origin/feature/myFeature` branches!
116
117You can delete these deprecated branches with the following:
118
119``` bash
120$ git checkout master
121$ git branch -D feature/myFeature
122$ git push origin :feature/myFeature
123```
View as plain text