Search code examples
gitversion-controlviewer

Folding git commits


I think that there must be a commit per feature. However, one big feature consists of series of useful pieces. Consider refactoring. Though, others say that refactorins are side effects of adding/modifying functionality and do not deserve a separate commit, consider I do a couple of fixes in the code. They all refactor different areas of the codebase. I do not want to commit a big mess so that it is difficult untangle, which changes are related. I therefore spawn more than one refactoring commit. However, most likely, people do not want to see all those tiny details. I therefore want to hide all refactoring commits under one folder of commits. In the history viewer, like gitk, I then should be able to expand/collapse the folder when desired. Is there a solution to this issue, might be solved in some other versioning control?


Solution

  • Use feature branches. Merge them into the mainline with git merge --no-ff. The mainline is then just a series of merge commits that show one feature added another, but if you want to see the individual commits that went into a feature, they're right there on the branch.