> For the complete documentation index, see [llms.txt](https://docs.inji.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.inji.io/readme/contribution/code-contribution.md).

# Code Contribution

## Overview

The recommended Github workflow here is for developers to submit code and documentation contributions to Inji open-source repositories.

### Repositories

{% embed url="<https://github.com/mosip/inji>" %}

## Setup your development machine

1. Fork the repository.
2. Clone the fork to your local machine. E.g.:

   ```
   $ git clone https://github.com/<your_github_id>/inji.git
   ```
3. Set the upstream project as the original from where you forked. E.g.:

   ```
   $ cd inji
   $ git remote add upstream https://github.com/mosip/inji.git
   ```
4. Make sure you never directly push upstream.

   ```
   $ git remote set-url --push upstream no_push
   ```
5. Confirm the origin and upstream.

   ```
   $ git remote -v
   ```

   This should display origin and upstream as below:

   ```
   origin	https://github.com/<your_github_id>/inji.git (fetch)
   origin	https://github.com/<your_github_id>/inji.git (push)
   upstream	https://github.com/mosip/inji.git (fetch)
   upstream	https://github.com/mosip/inji.git (push)
   ```

## Code changes

1\. Create a new issue in GitHub.

1. Follow the issue template provided.
2. Please provide as much information as possible.
3. If you want to develop a new feature, please elaborate on the idea and discuss the design before starting development. 2. In your local repository, fetch the upstream.

```
$ git fetch upstream
```

3\. On your local repo, switch to a branch if you are working on an older release or stay in `main/develop` branch.

```
$ git checkout upstream/<branch> 
```

{% hint style="info" %}
You will get a warning from git. Don't worry, our next step will take care of this warning.
{% endhint %}

4\. Create a new issue branch with the name of the issue.

```
$ git switch -c issue-<issue number>
```

5\. Make sure you are up-to-date with the upstream repo.

```
$ git pull upstream <branch> 
```

{% hint style="info" %}
You should do this quite often to ensure you are up to date.
{% endhint %}

6\. Now feel free to make the change in the code or documentation. Reach out to [our community](https://community.mosip.io) for any queries. Once done with the work, commit your changes by referring to the Issue ID in the commit message. Eg:

```
$ git commit -m "[#1234] Adding new feature in inji module"
```

7\. Once again ensure that you are up-to-date with the upstream repo as it may have moved forward.

```
$ git pull upstream <branch> 
```

8\. Build and test your code. Make sure to follow the coding guidelines. Provide unit test cases for the changes you have built.

9\. Push to your forked repo (origin).

```
$ git push --set-upstream origin issue-<issue number>
```

10\. On your forked remote repository from GitHub, create a pull request using the Contribute button. Direct the pull-request to `main` or any specific branch upstream.

{% hint style="info" %}
Most often it's the same branch in the upstream (as in Step 3).
{% endhint %}

11\. Make sure the automatic tests/checks on GitHub for your pull request pass.

12\. Reviewers shall review the pull request. Reach out to the [community](https://community.mosip.io) for a faster response.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.inji.io/readme/contribution/code-contribution.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
