I'm still learning about Git and source control in general, and I love hearing about various workflows.
And running tests before commit? Why not commit, run tests, then commit again? Do you really want to risk losing the work you just did because of a silly mistake (like piping something into a crucial file)?
If you're going to commit, run tests, and then commit again, I don't see a problem with it as long as you use git-rebase to squash those two commits together before you push them. The goal should always be to have the code in your main repository passing all tests at all times.
I've personally never worked this way, I don't commit until all tests are passing and I can't think of any time where I've ran into issues with this process. To each his own.
The "test first" extreministas write a test, write code to make that test pass, make it green, then commit. Lather, rinse, repeat. So the window for loss is exactly the work done for one small step of improvement.
I concur that it's nicest to then squash all of those tiny steps into a single feature/bug-fix chunk.
5 comments
[ 4.1 ms ] story [ 23.7 ms ] threadAnd running tests before commit? Why not commit, run tests, then commit again? Do you really want to risk losing the work you just did because of a silly mistake (like piping something into a crucial file)?
I've personally never worked this way, I don't commit until all tests are passing and I can't think of any time where I've ran into issues with this process. To each his own.
I concur that it's nicest to then squash all of those tiny steps into a single feature/bug-fix chunk.