Skip to content

Commit

Permalink
doc: remove section about amending commits in PR guide
Browse files Browse the repository at this point in the history
In my first contribution, I got the amending guidance wrongly and
amended my commit to attend some requested changes.

Amending commits is never required to author a PR in the project, and
force pushing makes reviewing harder, so the PR guide should not
recommend it as a good practice.

PR-URL: #41287
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
  • Loading branch information
Farenheith authored and targos committed Jan 14, 2022
1 parent 58da5d9 commit 3a80104
Showing 1 changed file with 4 additions and 11 deletions.
15 changes: 4 additions & 11 deletions doc/guides/contributing/pull-requests.md
Expand Up @@ -306,17 +306,10 @@ $ git push --force-with-lease origin my-branch
```

**Important:** The `git push --force-with-lease` command is one of the few ways
to delete history in `git`. Before you use it, make sure you understand the
risks. If in doubt, you can always ask for guidance in the pull request.

If you happen to make a mistake in any of your commits, do not worry. You can
amend the last commit (for example if you want to change the commit log).

```text
$ git add any/changed/files
$ git commit --amend
$ git push --force-with-lease origin my-branch
```
to delete history in `git`. It also complicates the review process, as it won't
allow reviewers to get a quick glance on what changed. Before you use it, make
sure you understand the risks. If in doubt, you can always ask for guidance in
the pull request.

There are a number of more advanced mechanisms for managing commits using
`git rebase` that can be used, but are beyond the scope of this guide.
Expand Down

0 comments on commit 3a80104

Please sign in to comment.