Why not git merge changes when the two branches are different, but without any new commits in any branch?

For instance,

I have things in my workshop. Another branch called other_branch has + more_stuff stuff in it. Each branch has nothing to do.

If I check the wizard, try to combine other_branch, git says "Already updated". and nothing happened. why in this case will no longer be merged into master? Is this how git was designed?

NOTE: other_branch was created from an older commit wizard.

+6
source share
2 answers

It is very simple. If git says β€œAlready updated”, this means that the branches did not diverge. Two branches diverge if at least one of the branches contains a commit, which the other branch does not have.

I'm not sure what you mean, has + more_stuff stuff. If you added new files to other_branch (or modified existing files) and used "git add" and "git commit", the history of other_branch will diverge from the main branch. Since git says that there are no changes in the merger, the story has not changed in this thread, i.e. You have not done anything.

+6
source

This only happens when the branch you are trying to merge is already contained in the current branch.

So, the more_stuff you more_stuff already in the main branch.

You can use gitk to check the visual tree of your branches.

+2
source

Source: https://habr.com/ru/post/911051/


All Articles