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.
Running the git stash command will take all the changes to tracked files in the working directory and stash them away. You can tack on the --include-untracked flag to make sure that untracked files are also included in the stash. You can take this a step further with the --all flag.
This is exactly the kind of scenario git stash is designed for. Git stash saves the uncommitted changes locally, allowing you to make changes, switch branches, and perform other Git operations. You can then reapply the stashed changes when you need them.
Cloning a Project with Submodules If you pass --recurse-submodules to the git clone command, it will automatically initialize and update each submodule in the repository, including nested submodules if any of the submodules in the repository have submodules themselves.
Multiple stash entries Subsequent stash entries are added to the beginning of the stash list. The most recent stash will have the reference stash@{0} . The stash list can contain stash entries from different branches, which could each be applied to other branches in your project.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With