|
|
|
|
|
by im-poor
1752 days ago
|
|
You still haven’t answered the question of why it’s valuable. You’re asking someone to do a lot of work by cleaning up their feature branch. What’s the benefit? The commits all get atomically added to master at the same time. Why would you want to revert to a state that master was never in? For instance, let’s say a feature is added and needs to be reverted. Personally, I prefer doing a single git revert <commit> and knowing that master is in a valid state. |
|
It's valuable in the same way that well structured code and good documentation is. In other words, it helps in terms of code base maintainability.
For example, I can run git blame on a line of code and see the reason it's there in the associated commit message. I can run git show on the sha value of the commit and see that line in the context of the change it's part of. That can help me in terms of not inadvertently introducing a regression by updating a particular line of code.
Of course, all that is highly dependent on well structured commits that only do one thing and have any informative commit message associated with them.
> You’re asking someone to do a lot of work by cleaning up their feature branch.
Not anymore than asking them to add proper documentation or additional test cases. It's not just about the change itself. It's how the change is presented in terms of documentation, organization, and in chunks that allow one to isolate a bug to a small part of the overall change.
> Personally, I prefer doing a single git revert <commit> and knowing that master is in a valid state.
Then you get a lot of churn that has to be filtered through to determine why a particular change was reverted. If you could add tests to verify the presence of a bug, and then just revert the part of the change responsible for the bug and update the assertions on the tests, then you can easily follow the sequence of events by looking at the history.