Do you feel comfortable merging code?

前端 未结 18 2019
心在旅途
心在旅途 2021-01-31 04:50

This morning, I read two opinions on refactoring.

  • Opinion 1 (Page not present)
  • Opinion 2 (Page not present)

They recommend branching (and s

18条回答
  •  北恋
    北恋 (楼主)
    2021-01-31 05:12

    I've only done it a couple times, so I'm not exactly comfortable with it.

    I've done it to conduct design experiments that would span over some checkins, so branching is an easy way to wall off yourself a garden to play in. Also, it allowed me to tinker while other people worked on the main branch, so we didn't lose much time.

    I've also done it when making wide ranging changes that would render the trunk uncompilable. It became clear in my project that I'd have to remove compile-time type safety for a large portion of the codebase (go from generics to system.object). I knew this would take a while and would require changes all over the codebase which would interfere with other people's work. It would also break the build until I was complete. So I branched and stripped out the generics, working until that branch compiled. I then merged it back into the trunk.

    This turned out pretty well. Prevented a lot of toe-stepping, which was great. Hopefully nothing like this will ever come up again. Its kind of a rare thing that a design will change requiring this kind of wide ranging edits that don't result in a lot of code being thrown out...

提交回复
热议问题