Most people submit pull requests to the tldr-pages project using GitHub's web interface.
If you prefer, you can do most of the process using the command-line instead. The overall process should look somewhat like this:
-
Fork the tldr-pages/tldr repository on the GitHub web interface.
-
Clone your fork locally:
git clone https://github.com/{{your_username}}/tldr.git && cd tldr
-
Create a feature branch, e.g. named after the command you plan to edit:
git checkout -b {{branch_name}}
⚠️ It is bad practice to submit a PR from themain
branch of your forked repository. Please create pull requests from a well named feature branch.
-
Make your changes (edit existing files or create new ones)
-
Commit the changes (following the commit message guidelines):
git commit --all -m "{{commit_message}}"
-
Push the commit(s) to your fork:
git push origin {{branch_name}}
⚠️ Please avoid force-pushing since it makes the review process harder.
- Go to the GitHub page for your fork and click the green "Compare & pull request" button.
Please only send related changes in the same pull request. Typically a pull request will include changes in a single file unless the pull request is introducing translations. (Exceptions are occasionally acceptable)
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.
- Via the GitHub web interface. Click
Fetch upstream
and thenFetch and merge
on the fork as shown below:
- Using Git in the terminal:
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
How to resolve merge conflicts
If the email that you used for the last commit isn't associated with your GitHub account, you can either add it here or change the email of the commit with the following commands:
git commit --amend --author="Your Name <[email protected]>"
git push --force-with-lease
Let's take this commit history as an example:
Commit Hash | Author Email |
---|---|
A | [email protected] |
B | [email protected] |
C | [email protected] |
D | [email protected] |
E | [email protected] |
F (HEAD) | [email protected] |
To change the email of commits A and D, run
git reset A
git commit --amend --author="Your Name <[email protected]>"
git cherry-pick B^..D # re-apply commits B to D
git commit --amend --author="Your Name <[email protected]>"
git cherry-pick E^..HEAD
git push --force-with-lease