Related: Should every git commit leave the project in a working state?
Suppose I make the following commits locally:
Modify the database schema, breaking the application.
Update the application so it is compatible with the database schema again.
As long as I push both commits, master
remains in a working state. However, a historical version is broken.
I'm aware that I can use git rebase -i
to squash the commits together. However, the resulting commit will be large and less descriptive. If I need to search the commit history to find out why I changed something, I'd rather find the original commit showing what I did and why.
My questions are:
Has anyone encountered difficulties due to broken historical commits in master?
If so, is there a simple way to avoid such difficulties, without discarding individual commit messages and changes?