Skip to content

Commit 4d84cd8

Browse files
authored
Merge pull request #176 from ipfs/feat/add-revert-changes-section
Adding a revert policy
2 parents 360ab15 + ac0090b commit 4d84cd8

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

contribution-guidelines.md

+22
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,28 @@ Before the pull request is merged, make sure that you squash your commits into l
211211

212212
We use LGTM (Looks Good To Me) in comments on the code review to indicate acceptance. A change **requires** LGTMs from the maintainers of each component affected. If you know whom it may be, ping them. If not, ping [@jbenet](https://github.com/jbenet).
213213

214+
### Reverting Changes
215+
216+
When some change is introduced, and we decide that it isn't beneficial and/or it causes problems, we need to revert it.
217+
218+
To make the review process and the changes easier, use git's `revert` command to revert those changes.
219+
220+
This suits a few purposes. First, it is much easier to see if some change was reverted by just looking into the history of the file. Imagine a commit with the title: _Add feature C_. There are many ways one could form the title for a commit reverting it, but by using `git revert`, it will be _Revert: "Add feature C"_ and thus very clear.
221+
Second, by using `git revert` we are sure that all changes were reverted. It is much easier to start again for state 0 and apply changes on it, than try to see if some transformation transforms state 1 to state 0.
222+
223+
#### What if a commit that is supposed to be reverted contains changes that are also good?
224+
225+
This usually means that commit wasn't granular enough. If you are the person that initially created the commit, in the future try to make commits that focus on just one aspect.
226+
227+
This doesn't mean that you should skip using `git revert`. Use it, then use `git cherry-pick --no-commit` to pull changes into your working tree and use interactive add to commit just the wanted ones. If interactive add is not enough to split the changes, still use interactive add to stage a superset of wanted changes and use `git checkout -- <file>` to remove unstaged changes. Then proceed to edit the files to remove all unwanted changes, and add and commit only your wanted changes.
228+
229+
This way your log will look like:
230+
231+
```
232+
AAAAAA Revert "Fix bug C in A"
233+
BBBBBB Re-add feature A tests that were added in "Fix bug C in A"
234+
```
235+
214236
### Labels
215237

216238
We make extensive use of Github labels to help us and our tools organize issues.

0 commit comments

Comments
 (0)