cd <path-to-submodule> 查看可用的分支: bash git branch -a 切换到指定的分支: bash git checkout <branch-name> 返回到主项目的根目录,并提交更改: bash cd .. git add <path-to-submodule> git commit -m "Switch
$ git commit -m “Switch submodule to branch ”“` 其中,``是子模块在主仓库中的路径,``是要切换的子模块分支的名称。 使用上述命令,先进入子模块所在的目录,切换到目标分支,拉取最新代码,然后返回主仓库目录,将更新后的子模块添加到主仓库的暂存区,最后提交到主仓库。 举个例子,假设我们要将子模块`...
【git系列】git-branch 含义用法选项示例详解 源自专栏《Gradle ScalaTest markdown idea Git中文实用教程目录?》概要git-branch 命令 - 列出、创建或删除分支 git branch [--color[=<when>] | --no-color] …
提示我们可以任意的修改和提交,通过切换回分支时不影响任何分支的状态。 在你没切走之前,可以创建一个新分支来保留所创建的提交,则可以通过在 switch 命令中使用 -c 来执行此操作: git switch -c <new branch name> 1. 如果你没有执行上面的命令,当你切走之后,会有一个警告。 在detached HEAD 状态下开发新...
【git系列】git switch含义用法选项示例详解 概要 描述 语法 选项 -c <new-branch>, --create <new-branch> -C <new-branch>, --force-create <new-branch> -d, --detach --guess, --no-guess -f, --force, --discard-changes -m, --merge --ignore-other-worktrees --recurse-submodules, --...
Git Submodules 使用git submodule将任何其他仓库拉入你的仓库 在git中,submodules让你把一个版本库装入另一个版本库,通常用于核心依赖关系或把组件分割成独立的版本库。更多信息,请看这个帖子。 运行下面的命令将把一个模块拉到指定的位置,同时创建一个.gitmodules文件,这样当repo被克隆时就会一直下载它。使用--rec...
一、submodule功能 有时候,一个项目会引用一些外部模块,特别是一些开源项目之间经常会有依赖(或者被依赖)。svn可以通过external来引用外部库,git则通过submodule实现。 但是,git对于submodule的处理比较简单。事实上,git submodule是一个bash脚本文件,很多选项是通过内置的(在git源代码中以C语言实现并被编译到git二进制中...
Solved: It appears that the default behaviour of SourceTree is to run git submodule update --init right after git checkout when switching branches.
git submodule如何切换commit?答: 操作步骤如下: $ cd <submodule dir> (进入子模块的源码目录) $ git checkout my-branch (切换到要使用的分支) $ cd .. (退出子模块) $ git status (检查commit的修改) --- a/submodule +++ b/submodule @@ -1 +1 @@ -Subproject commit ...
Just like git-submodule[1], this will detach HEAD of the submodules. EXAMPLES The following command switches to the "master" branch: $ git switch master After working in the wrong branch, switching to the correct branch would be done using: $ git switch mytopic However, your "wrong...