"merge without branch" 是如何工作的?

How does "merge without branch" work?

在此simple guide to git中,总是在分支上执行合并:

git merge <branch>

然而,在我的新工作环境中,我遇到了这样一种做法,开发人员从 master 拉取(即不到他们自己的分支)但是当他们推送他们的更改(他们在他们自己的 master 上执行)时,他们推送它到不同的 "master"(实际上是 "personal branch")。然后,CI 系统尝试将 "personal branch" 与 master(远程存储库)合并。

我知道这行得通,因为团队多年来一直这样工作。但是从 git 本身的角度来看,这样的事情是如何运作的呢?是否符合预期的git概念?

还是违反了一些基本原则?

I know this works, because the team has been working like this for years. But how does something like this works from the perspective of git itself
...

Then, the CI system attempts to merge that "personal branch" with the master (remote repository).

如果不指定分支 git 使用当前分支作为合并的 "second" 分支名称,在 git 中你可以写任意多的分支合并。

git merge A B C  ... N

git 将 select 基于分支数量的适当合并策略。


In my new work environment, however, I encountered a practice in which developers pull from the master (i.e. not to their own branch) but when they push their changes (which they performed on their own master), they push it to a different "master" (actually a "personal branch").

Then, the CI system attempts to merge that "personal branch" with the master (remote repository).

这种方式没有错。 Git 就像一头 未经训练的 野兽。你可以"train"任何你喜欢的方式,只要你擅长。

因此,如果这种方式适合您的 IT/devops 团队,则没有问题。