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.
Folding git commits
-
26-06-2022 - |
题
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?
解决方案
其他提示
I do not think it is possible to fold commits in gitk, maybe another viewer can do this. However, you can:
- Use interactive rebase to squash or fixup commits in one (History will be lost)
- View a diff for a range of commits:
sha1..sha2
. All changes fromsha1
tosha2
will be viewed as one change.