How to update a submodule version to latest ?
I always have to do this, there are a better way ?
You should actually just update with normal git methods like it's a standalone repo and then add the repo and commit:
cd submodule_name
git checkout master && git pull
cd ..
git add submodule_name
git commit -m "updating submodule to latest"
yeah I just git pull as well. we could probably do with something like this but I dont get the name at all, readd? what is that?
readd === re add || remove && add
Good thing to automate, but I don't know a better name for it. Suggestions ?
oh I see. but yeah we should change how it's done anyway, typically like @paularmstrong mentioned you just cd in git pull origin master and cd ..
update-submodules would be a more obvious, albeit verbose, command.
There's also a git submodule foreach method that you should consider wrapping this in so that all of a project submodules get updated.
update-submodule is easy to confuse with traditional git submodule update. Another suggestion ?
+1 nice idea.
Currently doing the usual:- git submodule foreach git pull origin master
The other way to update submodule which tracks branch is:
git pull --recurse-submodules
git submodule update --remote --recursive
Sorry for missing this!
@manobi Still interested to complete this?
If not any of you guys want to paw at it?
@kshcherban the best way, thanks! I also like to use --merge instead of --recursive, it persist current branch in submodule.
@spacewander Looks like we must bring in this?
So, what name should we use for it?
update-submodule or merge-submodule or others?
pull-submodule?
merge-submodule sound good if fetch and merge we could name it pull-submodule?
Ok, so name it as pull-submodule. I will try to dive into it this weekend.
:+1:
pull-submodule?
The following command will update all submodules to the latest branch that's defined in .gitmodules...
git submodule update --recursive --remote
[submodule "my/module"]
path = my/module
branch = master
git submodule foreach git pull origin master
git submodule update --remote