Update beginner's guide

This commit is contained in:
Zac 2024-07-02 12:46:35 -04:00 committed by GitHub
parent 724493a1ef
commit bb9f60e5fe
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -12,7 +12,7 @@ Use a terminal or GitHub GUI to clone the forked repo to your machine.
**3. Create a new branch for your changes**
Navigate to the `sly1` directory and run the following command:
Navigate to the `sly1` directory in the terminal, and run the following command:
```sh
git checkout -b branch-name
@ -20,34 +20,45 @@ git checkout -b branch-name
Replace `branch-name` with whatever you want to call your working branch. This will automatically create a new branch and switch to it.
**4. Write your code**
**4. Write & match your code**
Write your code in the `src/P2` directory. You can use any text editor you like, but we recommend [Visual Studio](https://visualstudio.microsoft.com/downloads/).
**4b. Write test cases**
If you are adding new code, it is strongly recommended that you also write unit tests for it. See the [contributing guide](/docs/CONTRIBUTING.md#writing-tests) for more information.
**4c. Match your code**
You can follow the [Code Matching Guide](/tools/codematcher/README.md) to match your code against the Sly 1 May 2002 Prototype. This will tell you if your code is exactly the same as the original code. This is not perfect because the prototype is not the same as the final release, but it is still a good way to make sure your code is correct.
Follow the [Contributing Guide](/docs/CONTRIBUTING.md) to find functions to match, and write your code. You can use any text editor you like, but we recommend [VS Code](https://code.visualstudio.com/).
**5. Commit the changes to your branch**
Whenever you feel you have reached a point where you would like to save your progress, you should *commit* your changes the working branch with the following command.
Whenever you would like to save your progress to the fork, use these commands to add the files to a commit with a message describing what you did:
```sh
git commit -am "What you did"
git add file_you_changed.txt
git commit -m "Describe what you did here"
```
If you only want to commit certain files, first add the them to the commit with `git add <files>`, then commit with `git commit -m "What you did"`.
If you don't care about adding specific files and just want to commit every file you changed, you can use this command instead:
Use `git status` to see which files you've changed. If a file is red, it means that the file has been modified, but not added to the commit. If a filename is green, it means that the file has been added to the commit.
```sh
git commit -am "Describe what you did here"
```
The commits are not backed up to GitHub until you `git push` to the repo in the next step.
**6. Push the commits to your fork**
When you are done making commits, push your branch to your forked repo. Use `git push origin branch-name` to push your branch to your forked repository.
When you are done making commits, push your branch to your forked repo.
```sh
git push origin branch-name
````
**7. Create a pull request on GitHub**
When you are have pushed all commits to your fork and are ready to submit your code, create a pull request on GitHub. Go to your forked repository on GitHub and click the "Pull requests" tab. Then click the "New pull request" button. Select your branch from the "compare" dropdown menu and click "Create pull request".
When you are have pushed all commits to your fork and are ready to submit your code, create a pull request on GitHub.
1. Go to your forked repository on GitHub and click the "Pull requests" tab.
2. Click the "New pull request" button.3
3. Select your branch from the "compare" dropdown menu.
4. Click "Create pull request".
6. Add a title and brief description stating what you did for the person reviewing it.
**8. Wait for someone to review your code**
A code reviewer will review your PR and either merge it into the main branch, or let you know if there are any issues that need be addressed. If you need to fix something, any commits you push to the same branch will be automatically added to the pull request until it is merged, at which point you will have to make another pull request if you continue working.