git checkout <branch_name> # 切换submodule的branch git commit -am "change_summary" # 提交submodule的commit#or#更新submodule源码,默认更新的branch是master,如果要修改branch,在.gitmodule中设置git submodule update --remote <submodule_name>#更新所有submodule源码,默认更新.gitmodule中设置的跟踪分支,未设置...
提交submodule 我们在project-main下,git status发现,多出来的是.gitmodules和文件夹project-sub-1,我们将它们视为普通的文件,提交并推送到远程。 anders@ubuntu:~/repo/project-main$ git status On branch master No commits yet Changes to be committed: (use "git rm --cached <file>..." to unstage) ...
git submodule foreach git submodule update 修改Submodule 有些时候你需要对submodule做一些修改,很常见的做法就是切到submodule的目录,然后做修改,然后commit和push。 这里的坑在于,默认git submodule update并不会将submodule切到任何branch, 所以,默认下submodule的HEAD是处于游离状态的(‘detached HEAD’ state)。 所...
[submodule "submods/newtestrepo"] 这个section,为每一个submodule都正在prepo的.git/config文件中增加一条 [submodule "submods/newtestrepo"] url = git@github.com:cnweibo/newtestrepo.git 信息! (newcnweibo_branch)$pwd/home/cabox/workspace/testgit/githubtest (newcnweibo_branch)$ git submodule ini...
用git checkout master将 HEAD 从游离状态切换到 master 分支 , 这时候,git 会报 Warning 说有一个提交没有在 branch 上,记住这个提交的 change-id(假如 change-id 为 aaaa)。 用git cherry-pick aaaa来将刚刚的提交作用在 master 分支上。 用git push将更新提交到远程版本库中。 3.3、删除 submodule : 有...
Here we have changed directory to the awesomelibrary submodule. We have created a new text filenew_awesome.txtwith some content and we have added and committed this new file to the submodule. Now let us change directories back to the parent repository and review the current state of the pare...
这里的坑在于,默认git submodule update并不会将submodule切到任何branch,所以,默认下submodule的HEAD是处于游离状态的(‘detached HEAD’ state)。所以在修改前,记得一定要用git checkout master将当前的submodule分支切换到master,然后才能做修改和提交。 如果你不慎忘记切换到master分支,又做了提交,可以用cherry-pick命...
[--] <path>…)git submodule[--quiet] update [<options>] [--] [<path>…]git submodule[--quiet] set-branch [<options>] [--] <path>git submodule[--quiet] set-url [--] <path> <newurl>git submodule[--quiet] summary [<options>] [--] [<path>…]git submodule[--...
git submodule[--quiet] add [-b <branch>] [-f|--force] [--name <name>] [--reference <repository>] [--depth <depth>] [--] <repository> [<path>]git submodule[--quiet] status [--cached] [--recursive] [--] [<path>…]git submodule[--quiet] init [--] [<path>…]gi...
这里的坑在于,默认 git submodule update 并不会将 submodule 切到任何 branch,所以,默认下 submodule 的 HEAD 是处于游离状态的 (‘detached HEAD’ state)。所以在修改前,记得一定要用 git checkout master 将当前的 submodule 分支切换到 master,然后才能做修改和提交。