I have a git repository for a library for which I occasionally add new features (or maybe update the existing ones, still same steps).
Whenever I do, I need to do three things:
- Add the implementation
- Add tests
- Update README.md
Now I have two options:
Put them all in one commit:
- Commit 1:
Add FEATURE_NAME + tests + update README.md
- Commit 1:
Put them in three different commits:
- Commit 1:
Add FEATURE_NAME
- Commit 2:
Add tests for FEATURE_NAME
- Commit 3:
Update README.md for FEATURE_NAME
- Commit 1:
If I go with the first option, then it will be easier to revert it if I decide my feature is bad, since I only need to deal with one commit.
If I go with the second option, it separates my work into different commits which makes sense.
Which option is better (or maybe there is another way altogether) and why?