Merge pull request #1878 from nikhita/document-revert-process

contributor guide: document the revert process
This commit is contained in:
k8s-ci-robot 2018-06-28 09:51:24 -07:00 committed by GitHub
commit ae3a1fde7e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 44 additions and 0 deletions

View File

@ -251,3 +251,47 @@ git rebase -i upstream/master
For mass automated fixups (e.g. automated doc formatting), use one or more For mass automated fixups (e.g. automated doc formatting), use one or more
commits for the changes to tooling and a final commit to apply the fixup en commits for the changes to tooling and a final commit to apply the fixup en
masse. This makes reviews easier. masse. This makes reviews easier.
### Reverting a commit
In case you wish to revert a commit, use the following instructions.
_If you have upstream write access_, please refrain from using the
`Revert` button in the GitHub UI for creating the PR, because GitHub
will create the PR branch inside the main repository rather than inside your fork.
1. Create a branch and sync it with upstream.
```sh
# create a branch
git checkout -b myrevert
# sync the branch with upstream
git fetch upstream
git rebase upstream/master
```
2. If the commit you wish to revert is a:
- merge commit:
```sh
# SHA is the hash of the merge commit you wish to revert
git revert -m 1 SHA
```
- single commit:
```sh
# SHA is the hash of the single commit you wish to revert
git revert SHA
```
3. This will create a new commit reverting the changes.
Push this new commit to your remote.
```sh
git push ${your_remote_name} myrevert
```
4. [Create a Pull Request](#7-create-a-pull-request) using this branch.