Best Practices
By Subject Expert Admin
Summary
Summary
0
Teachers with
Subject Expert Admin
0
Followers
For Learning
All
Visibility
Security Status
0
Contributions
By Teachers
Notes
- Students are auto-evaluated against related topics to ensure they learned it.
Follow the following best practices while working with Git.
Commits should be Small and Isolated
When coding away, its good to group the changes into small isolated commits. Ideally each would compile, but that's not super important as long as the entire PR compiles.
The benefits to small commits are:
- It's very easy for reviewers to review logical pieces of the PR one at a time
- It allows for grouping refactoring & formatting into their own commits, so that reviewers can review each commit individually without needing to see the formatting in the full diff
- Grouping things into small commits forces me to re-think & re-review the changes before I ask others to. I often catch things in this phase which avoid wasted back & forth in the review process
- It makes it easier to create helpful commit messages explaining why changes were needed. This is crucial for when we need to go back and see why a change was made, either because it has issues, or because we want to modify the code in the future, but need to know why specific changes were needed
- Smaller commits makes it more difficult for unintended changes to sneak into a PR
- It makes it easier to do a git bisect to identify a specific commit which introduced an issue (this only works if the commits compile)