jenkins + Git submodule automatic pulling Code
Add Git submodules
first cloned want to add warehouse sub-module git clone ssh://git@ip:port/user/project.git
, this is your home directory.
Into the warehouse, adding sub-module git submodule add ssh://git@ip:port/user/project.git
, and the main warehouse are different.
ls
View, there will be .gitmodules
the project name and the sub-modules.
The generated files and directories push to the main repository.
Cloning warehouse submodule
Adding too warehouse sub-module, if you want to re-cloning, and general cloning the same, but after cloning should be executed in the warehouse catalog
git submodule init
and git submodule update
, if not executed, sub-modules will be no files.
Change the sub-module branch
To switch to the directory module, sub-module is a default master branch git submodule foreach git checkout dev
,
then git submodule foreach git pull
branch switching.
Necessary jenkins
tasks 构建步骤
added git submodule init
and git submodule update
, and said operation (a write command in the latter two),
jenkins
in order to pull the code.
submodule can tag and merge
git submodule foreach
May each sub-module is operating, so that all sub-modules tag
and merge
operations equivalent to total items corresponding operation.