Is it possible to bind commits to each other to make them atomic in terms of bisect, cherry-pick, revert, etc?

前端 未结 2 2008
时光取名叫无心
时光取名叫无心 2021-02-13 09:50

Consider the case of a bug fix which causes a small change in the expected output, forcing a minor change in the test suite. It is extremely convenient to have both changes in

相关标签:
2条回答
  • 2021-02-13 10:32

    Definitively keep those changes (code and unit test) as one commit: SCM is also about being able to reproduce a given state, and that include both the program and its tests.

    If you need to review only code changes, do a git diff on src only, not on tst.
    Since those linked changes remain in one commit, you avoid the bisect issue entirely.

    In short, keep it simple ;)

    0 讨论(0)
  • 2021-02-13 10:33

    If you like, you can keep them in separate commits in a development branch. After each pair of commits, merge into the feature branch. This should give you the ability to do either way.

    0 讨论(0)
提交回复
热议问题