diff --git a/assets/images/repository-header.png b/assets/images/repository-header.png new file mode 100644 index 0000000..48c582e Binary files /dev/null and b/assets/images/repository-header.png differ diff --git a/set-up-development-environment.md b/set-up-development-environment.md new file mode 100644 index 0000000..48b4879 --- /dev/null +++ b/set-up-development-environment.md @@ -0,0 +1,77 @@ +# Setting up a Local Development Environment +In order to work on the HPR codebase, first of all create your +account, as explained in [developer information](developer_information.md). + +## Create your local environment +The next step is to create your development environment locally: +1. Fork the HPR repository you want to work on. Do this by clicking + the Fork button top right in the repository header: + + ![repository header](assets/images/repository-header.png) + +2. Go to your terminal on your computer, and clone the HPR repository + locally: + ```` + $ git clone gitea@repo.anhonesthost.net:[YOUR_USER]/hpr_documentation.git + ```` + It doesn't matter if you use the ssh or http link for the code - + you don't have write access to the main repository, so you won't be + pushing code back there. +3. Change to the clone repository - you will now see the remote listed + as origin: + ```` + $ cd hpr_documentation + $ git remote -v + origin gitea@repo.anhonesthost.net:[YOUR_USER]/hpr_documentation.git (fetch) + origin gitea@repo.anhonesthost.net:[YOUR_USER]/hpr_documentation.git (push) + ```` +4. Create a remote for your fork of the repository: + ```` + $ git remote add upstream gitea@repo.anhonesthost.net:[YOUR_USER]/hpr_documentation.git + $ git remote -v + origin gitea@repo.anhonesthost.net:[YOUR_USER]/hpr_documentation.git (fetch) + origin gitea@repo.anhonesthost.net:[YOUR_USER]/hpr_documentation.git (push) + upstream gitea@repo.anhonesthost.net:[YOUR_USER]/hpr_documentation.git (fetch) + upstream gitea@repo.anhonesthost.net:[YOUR_USER]/hpr_documentation.git (push) + ```` + +You now have a repository you can keep up to date with the main repo, +and also work on making additions. + +## Making code changes +1. In order to make changes, the first step is to update your local + repository: + ```` + $ git checkout main # In case you are still in a branch from an earlier change + $ git pull origin + ```` +2. Create a branch to work on the changes: + ```` + $ git checkout -b adding-developer-setup-information + ```` +3. Make the changes +4. Check the changes work! You don't want to push broken code upstream! +5. Commit your changes locally + ```` + $ git add * + $ git commit + ```` + Note - the commit message should have the issue number at the + beginning. So in this case, "I6 - Document how to create local + environment" +6. Push the changes to **your** repository: + ```` + $ git push upstream + ```` +7. Go to your repository online - you will now see an option to create + a pull request against the main HPR repository. Click the Create + **Pull Request** button and fill out the form. + +8. Once the pull request is accepted, you can delete your local branch + if you wish. + +## Summary +Using this approach means contributing is straight forward, and +doesn't require everyone to have write access to the main HPR +repositories. Since you are pulling from the origin repositories, you +will always be working on up to date code.