跳至主要内容

博文

目前显示的是 八月, 2022的博文

Why is my Git Submodule HEAD detached from master?

 原始链接 From  git submodule --help ,  HEAD detached is the default behavior  of  git submodule update --remote . This has nothing to do with which branch is being tracked in a submodule. For anyone only want a solution, jump to the 2nd part directly. Reason We need to understand what a submodule is. Submodule is a way to include another project into your current project. It's not really adding these files into the commit history of your main project, but by referring a snapshot (commit) of the submodule. Quote from  Starting with Submodules  section in book  Pro Git Although sbmodule  DbConnector  is a subdirectory in your working directory, Git sees it as a submodule and doesn’t track its contents when you’re not in that directory. Instead, Git sees it as a  particular commit from that repository . Every commit of a repo is a snapshot/state of your code at that time. The state of submodule at that time has to be  deterministic ...