I’m currently working on setting up a Gitea repository and I’ve encountered a situation that I need help with. I have a submodule in my repository which is a code library that is used across multiple repositories.
My goal is to ensure that every time a pull is made, regardless of the method (console, Visual Studio, etc.), the submodules also should get updated to the newest head of the main branch. This should happen even when there are only changes in the submodule and not in the main repository.
Does anyone have experience with this or can provide some guidance on how to achieve this? Any help would be greatly appreciated.
Thank you in advance!
git pull --recurse-submodules
does not update the submodule to the newest head and i did not find a way to intergrate it into Visual Studio.
Edit: I tried to use Git hooks, but there is no post pull hook and the post merge hook does not trigger when there are no changes in a pull
You can write an shell alias that will git pull
the main repo and also execute git submodule foreach --recursive 'git pull origin master'
, e.g.
alias gp="git pull && git submodule foreach --recursive 'git pull origin master'"
if you want to have it automatically you can try this:
git config alias.pull '!git pull && git submodule foreach --recursive "git pull origin master"'
it should override the function of the git pull
command, but only for this repository.