When working with version control, the history generally looks like a flat chain of revisions. There is some rudimentary mechanism of organizing a hierarchy (I mean branches), but it doesn't seem flexible enough. What are common practices (version control agnostic) to organize revisions in multi-level hierarchies and what are version control tool specific gotchas?
I'll provide a trivial real world example from my practice which lead me to this question.
Assume I want to refactor a function/class method. I create a ticket and name it let's say "Refactor method ClassName.method_name()". After studying the code of method_name(), I divide the refactoring process into subtasks. For simplicity, let's consider I need to rename two variables with different meanings in the code, so I need to do it in two distinct atomic steps. I rename a variable, save the changes and commit with message "renamed foo variable in ClassName.method_name()" (because committing early and committing often is good). I repeat for the second variable: "renamed bar variable in ClassName.method_name()".
Now I have one ticket in the issue tracker, named "Refactor method ClassName.method_name()" and two revisions in version control:
- "renamed foo variable in ClassName.method_name()"
- "renamed bar variable in ClassName.method_name()"
Where is the relation between the issue and these two revisions? I'm lost!
My goal is to have a logical hierarchy like this:
- "Refactor method ClassName.method_name()"
- "renamed foo variable in ClassName.method_name()"
- "renamed bar variable in ClassName.method_name()"
Needless to say I'm looking for general workflows, which would allow creating multi-level hierarchies like this one. Each item of the hierarchy can be a revision or a ticket, the situation with a ticket being fixed by a chain of consecutive revisions is just a particular case.
This would make sense, I'm a fan of using outliners and organizing data into hierarchies using trees.
How do people do this in version control? There are many version control tools, each have their subtleties, some allow to include third party bug trackers right into the repository, some even have integrated bug tracking (like fossil), so please elaborate on workflows for particular version control tools.