datps
datps

Reputation: 768

How does "merge without branch" work?

In this simple guide to git, a merge is always performed on a branch:

git merge <branch>

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).

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? Is it in line with the intended git concepts?

Or does it violate some basic principle?

Upvotes: 4

Views: 73

Answers (1)

CodeWizard
CodeWizard

Reputation: 142632

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).

If you don't specify branch git use the current branch as the "second" branch name for the merging, in git you can write as many branches as you want for the merge.

git merge A B C  ... N

git will select the appropriate merge strategies based upon the number of branches.


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).

There is nothing wrong with this way. Git is like an untrained beast. You can "train" any way you like as long as you are good with it.

So if this way suit your IT/devops team there is no problem with it.

Upvotes: 2

Related Questions