DEV Community

Discussion on: When to make a Git Commit

Collapse
 
joshcheek profile image
Josh Cheek

A third context I seem to hit a lot is debugging something external. Eg if CI or the server is failing for some reason, I can't fix it locally, I might commit a series of changes trying to get it to do what I want. Or if I work on it on my computer, I might push so that I can pull on my Windows machine and run the tests there. It needs to pass tests on both environments, but it needs to be committed to travel between them.

Also, I sometimes leave WIP commits in b/c they include useful experiments / places I got to that I wasn't sure if they were useful or not. The final commit might be cleaned up and elegant, but seeing that intermediate state can be useful when you return to that code or API.