Stash everything in Git including all submodules?

When a project contains submodules you need to stash/unstash all of them separately. Is there a way to do it using less actions?

This link maybe helpful:

Easy way pull latest of all submodules

It is about "pull" command but there are some ways how to iterate between all the submodules.


You can use foreach to run a specific git command on each sub-module. For example to apply 'git stash' to every modules use this:

git submodule foreach 'git stash'

Similarly, the following command will checkout master branch and then pull any updates from the remote source for each submodule.

git submodule foreach 'git checkout master; git pull'

Read more at: http://git-scm.com/book/en/v2/Git-Tools-Submodules

链接地址: http://www.djcxy.com/p/92388.html

上一篇: 通过子模块显示Git中的外部代码依赖性

下一篇: 将所有东西都存放在Git中,包括所有子模块?