Workspace
A workspace tracks git repositories without relying on git submodules.
Inside a workspace you can use the usual every day git-operations. The sole purpose of bob git
is to enhances git for the multi-repo case.
info
In case of a monorepo you can just ignore workspaces.
The cmds bob clone
and bob git
are intended to operate on a workspace.
bob workspace
- track repositories and remotes.bob clone
- clone entire workspaces and single repositories.bob git
- like git, but for multi-repos.
bob workspace init
Initalizes a new workspace by creating a .bob.workspace
file in the current directory. This file should be under version control.
bob workspace add
Add repositories to a workspace.
bob workspace add git@github.com:Benchkram/bob.git
Creates a entry in .bob.workspace
and adds the checkout directory to the .gitignore file of your workspace. The repository is not yet cloned to your workspace. A repository added to a workspace is called tracked.
Tracked repositories can be cloned using
bob clone
Already cloned repositories are ignored.
bob clone
Clone can be used like plain git clone
.
bob clone git@github.com:Benchkram/bob.git
In case the repository contains a *.bob.workspace. file it clones them recursively.
You can also run
bob clone
directly in a repository containing a .bob.workspace
file. It will clone all tracked repositories.
bob git
Behaves closly to plain git
but optimised to operate on mutliple repositories.
bob git
will execute the operation in relation to the top most .bob.workspace
file it can find.
bob git status
An example of bob git status
in a workspace.
Highlighted directories indicate child git repositories. Therefore bob git add
and bob git commit
will only operate on the repository a file belongs to allowing to create repository overlapping commits all together.
bob git add
Adds each file to the respective repository it belongs to as shown by bob git status
.
This means you can copy+paste lines from bob git status
directly into bob git add
.
bob git add . # add CWD (for all repos below CWD)
bob git add * # match all (below CWD)
bob git add a/ # add everything in directory a/
bob git add a/*.yaml; # add yaml file in directory a/
bob git add ../b; # if ../ results in another git repo ../b is added there.
bob git add one two # multiple path specs
bob git commit
Runs git commit
on each repository in a workspace. First git commit --dry
is executed on all repositories. Execution is stopped in case of an error.
The output of the underlying git
command is piped to the terminal. Similar to this:
/ success
[master 7ad56ed] "commit msgs"
1 file changed, 3 insertions(+), 1 deletion(-)
second-level/ success
[master d2c5a7b] "commit msgs"
1 file changed, 4 insertions(+), 1 deletion(-)
bob git push
wip
bob git stash
wip