How to prevent detachment of HEAD during merge?

Is there a way for config git to reject merging if the action results in a disabled HEAD?

I know how to solve detached HEAD, but I would prefer Git to reject the merge action to completely exclude a separate HEAD.

The problem occurs when this happens:

  • I am working on the develop branch of the main repo, and I have also made some changes to the submodule repository. The develop updated in accordance with the latest submodule commit.
  • A colleague wants to combine develop into master , but forgets to first transfer the submodule to master . This results in a disconnected head.
+5
source share
1 answer

A submodule always in a disconnected head state because Git does not store any information about which branch it should be.

Git tracks the binding of the submodule to which it is connected, because it is saved along with the commit information. When you merge two different branches that are associated with different submodule , Git cannot check a branch in the submodule for why you have a separate HEAD.

There is no solution that allows your submodules to connect to the branch.

Possible solution to your problem:

https://github.com/kollerma/git-submodule-tools

0
source

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


All Articles