Use of git rebase in public feature branches

前端 未结 3 455
余生分开走
余生分开走 2021-01-30 11:31

You can see all over the web people advising to not use git rebase in a public branch, but I can\'t see what\'s the problem, if you always rebase a feature branch.<

3条回答
  •  再見小時候
    2021-01-30 11:58

    If you rebase, you rewrite history. And just like in the real world, if you want to rewrite history, you need a conspiracy: everybody has to be "in" on the conspiracy (at least everybody who knows about the history, i.e. everybody who has ever pulled from the branch).

    As long as the circle of people who pull from the branch is tightly controlled, it is fairly easy to get a conspiracy going, however, as soon as you publish that history, it becomes a lot harder. It's not impossible, though: the pu branch in Junio C Hamano's Git repository for example, gets rebased after every release, and that is a widely published repository. The way this works is that the fact that the branch will be frequently rebased and the times when that will happen, are widely documented on the Git website, the Git wiki and the Git mailinglist, and every rebase is announced on the mailinglist in advance so that people can prepare for it.

提交回复
热议问题