2021-06-29 18:00:13 +01:00
# Opening a Pull Request
2020-05-11 00:23:54 +01:00
Most people submit pull requests to the tldr-pages project
2017-11-27 19:03:11 +00:00
[using GitHub's web interface][pr-howto].
2017-11-27 18:43:52 +00:00
2021-05-20 21:13:41 +01:00
If you prefer, you can do most of the process using the command-line instead.
2017-11-27 19:03:11 +00:00
The overall process should look somewhat like this:
2017-11-27 18:43:52 +00:00
2020-05-11 00:23:54 +01:00
1. Fork the tldr-pages/tldr repository on the GitHub web interface.
2017-11-27 18:43:52 +00:00
2020-03-11 00:27:49 +00:00
2. Clone your fork locally:
2017-11-27 18:43:52 +00:00
`git clone https://github.com/{{your_username}}/tldr.git && cd tldr`
2020-03-11 00:27:49 +00:00
3. Create a feature branch, e.g. named after the command you plan to edit:
2017-11-27 18:43:52 +00:00
`git checkout -b {{branch_name}}`
2021-10-27 18:51:53 +01:00
> :warning: It is bad practice to submit a PR from the `main` branch of your forked repository. Please create pull requests from a well named feature branch.
2017-11-27 19:03:11 +00:00
4. Make your changes (edit existing files or create new ones)
2017-11-27 18:43:52 +00:00
2020-03-11 00:27:49 +00:00
5. Commit the changes (following the [commit message guidelines][commit-msg]):
2017-11-27 18:43:52 +00:00
`git commit --all -m "{{commit_message}}"`
2020-03-11 00:27:49 +00:00
6. Push the commit(s) to your fork:
2017-11-27 18:43:52 +00:00
`git push origin {{branch_name}}`
2021-10-27 18:51:53 +01:00
> :warning: Please avoid force-pushing since it makes the review process harder.
2021-10-01 20:22:50 +01:00
7. Go to the GitHub page for your fork and click the green "Compare & pull request" button.
2017-11-27 18:43:52 +00:00
2017-11-27 19:03:11 +00:00
Please only send related changes in the same pull request.
2021-10-27 18:51:53 +01:00
Typically a pull request will include changes in a single file **unless the pull request is introducing translations** .
(Exceptions are [occasionally acceptable][mass-changes])
2017-11-27 19:03:11 +00:00
[pr-howto]: ../CONTRIBUTING.md#submitting-a-pull-request
[commit-msg]: ../CONTRIBUTING.md#commit-message
2019-12-07 22:36:53 +00:00
[mass-changes]: https://github.com/tldr-pages/tldr/pulls?& q=is:pr+is:merged+label:"mass+changes"
2021-06-29 18:00:13 +01:00
# Updating your fork
Forks of GitHub repositories aren't updated automatically. To keep your fork up-to-date with the latest changes and avoid merge conflicts, you should update it regularly.
There are two ways to update your fork.
1. Via the GitHub web interface. Click `Fetch upstream` and then `Fetch and merge` on the fork as shown below:
2021-10-14 11:06:21 +01:00
![Fetch and merge button in GitHub ](../images/github-fetch-and-merge-button.png )
2021-06-29 18:00:13 +01:00
2. Using Git in the terminal:
```bash
git checkout main
git remote add upstream https://github.com/tldr-pages/tldr.git # only run if you don't already have the upstream remote (check with "git remote -v")
git fetch upstream main
git rebase upstream/main # in case you have any merge conflicts, click the link below to see how to resolve them
git push --force-with-lease # not needed if you only want to update your local repository
```
2021-09-16 04:32:13 +01:00
[How to resolve merge conflicts ](https://docs.github.com/en/github/collaborating-with-pull-requests/addressing-merge-conflicts/resolving-a-merge-conflict-using-the-command-line )
2021-06-29 18:00:13 +01:00
# Changing the email of your last commit
If the email that you used for the last commit isn't associated with your GitHub account, you can either add it [here ](https://github.com/settings/emails ) or change the email of the commit with the following commands:
```bash
git commit --amend --author="Your Name < new.email @ example . com > "
git push --force-with-lease
```
# Changing the email of any commit(s)
Let's take this commit history as an example:
| Commit Hash | Author Email
|---|---
| A | wrong@example.org
| B | correct@example.org
| C | correct@example.org
| D | wrong@example.org
| E | correct@example.org
| F (HEAD) | correct@example.org
2021-09-16 04:32:13 +01:00
To change the email of commits A and D, run
2021-06-29 18:00:13 +01:00
```bash
git reset A
git commit --amend --author="Your Name < correct @ example . org > "
git cherry-pick B^..D # re-apply commits B to D
git commit --amend --author="Your Name < correct @ example . org > "
git cherry-pick E^..HEAD
git push --force-with-lease
```