Command line utility to work with multiple git repositories at once
Currently intended for personal use only, but quite functional
- cd extlibs/SSV...
- cmake .
- make
- sudo make install
three times for each lib
afterwards in the project root
- cmake .
- make
- sudo make install
Using git-ws in a directory calls git commands in all subdirectiories which are git repositories.
git-ws ?: displays auto-generated help for all commandsgit-ws ? (command name): displays auto-generated help for a commandgit-ws query: displays all repos detected by git-wsgit-ws push: push staged changesgit-ws push -f: force push staged changesgit-ws push -a: push staged changes, only in repos ahead from remotegit-ws pull: pull latest versiongit-ws pull -s: pull latest version, stashing all changes before pullinggit-ws statusorgit-ws st: displays short git status, ignoring dirty submodulesgit-ws submodule pushorgit-ws sub push: commits all staged changes and pushes (intended to be used only after non-submodule changes have been pushed)git-ws sub pull: stashes all submodule local changes, pulls latest submodules recursivelygit-ws sub au: equivalent ofgit-ws submodule pullfollowed bygit-ws submodule pushand bygit submodule updategit-ws do 'command here': creates a subshell in every git repo folder, and executes a bash command in itgit-ws do -c 'command here': creates a subshell in every git repo folder with changes, and executes a bash command in itgit-ws do -a 'command here': creates a subshell in every ahead git repo folder, and executes a bash command in it
Real-life situation: I'm working on Open Hexagon and related libraries.
I create a OHWorkspace folder, where I clone all the required git repos.
mkdir OHWorkspace; cd OHWorkspacegit clone http://.../SSVUtilsgit clone http://.../SSVUtilsJsongit clone http://.../SSVStartgit clone http://.../<etc>git clone http://.../SSVOpenHexagon
Now my directory tree looks like this:
OHWorkspace/
...
SSVUtils/
.git/
...
SSVUtilsJson/
.git/
...
SSVStart/
.git/
...
SSVOpenHexagon/
.git/
...
I work on all the repos simultaneously. I constantly need to check what repos I've modified.
cd OHWorkspace/; git-ws st(st == status)- returns a human-readable list of changes
After I review changes, it's time to commit.
git-ws gitg -corgit-ws do "open your favorite GUI here"(this opens gitg in every repo with changes to commit)
I use gitg to make my commits.
git-ws push -a; git-ws sub au(these two commands save a lot of time: first, all staged commits in ahead repos are pushed to GitHub - then, every submodule is recursively pulled, updated, and pushed, so that the online submodules are up-to-date)