A logically atomic commit is the smallest, most meaningful change you can make to the software. It’s big enough to add value, but small enough to be manageable.
It bundles useful changes together essentially.
source: https://benmatselby.dev/post/logical-commits/
Scenario:
- You have developed an awesome rolling rick feature.
- The development have happened over a couple of days and you've committed regularly.
- You create a pull request: #2
- You realize you can present it better with logically atomic commits. Something more like: #1
Instructions for exercise:
- Checkout branch
main
if not already there. - Open index.html in a browser to have a look at it's state.
- Checkout branch
start
. - Refresh index.html to visually see how the branch differs from
main
. - Create a new branch
exercise
. - Have a look at the commits in
solution
branch. - Rewrite
exercise
branch to contain the same commits as seen in thesolution
branch.
Tips:
- Soft reset the
exercise
branch. - Commit only parts (hunks) of the files.
- Use a GUI client such as GitExtensions (Win), Fork (Mac + Win) or GitKraken (Linux, Mac, Win) so that you don't have to figure out the git cli commands for doing the above.