Working with workspaces¶
For the sake of this example we will assume a
josh-proxy instance is running and serving a
http://josh/world.git with some shared code in
Create a new workspace¶
To create a new workspace in the path
ws/hello simply clone it as if it already exists:
$ git clone http://josh/world.git:workspace=ws/hello.git
git will report that you appear to have cloned an empty repository if that path does not
If you don’t get this message it means that the path already exists in the repo but may
not yet have configured any path mappings.
The next step is to add some path mapping to the
workspace.josh file in the root of the
$ cd hello $ echo "mod/a = :/shared/a" > workspace.josh
And and commit the changes:
$ git add workspace.josh $ git commit -m "add workspace"
If the path did not exist previously, the resulting commit will be a root commit that does not share
any history with the
This means a normal
git push will be rejected at this point.
To get correct history, the
resulting commit needs to be a merge of our newly created workspace history with the history that
already exists in
There is however no way to do this merge locally, because we don’t have the data required for this.
Also, the resulting tree should contain the contents of
shared/a mapped to
means it needs to be produced on the server side because we don’t have the files to put there.
To accomplish that push with the merge option:
$ git push origin HEAD:refs/heads/master -o merge
While it is perfectly possible to use Josh without a code review system, it is strongly recommended to use some form of code review to be able to inspect commits created by Josh before they get into the immutable history of your main repository.
As the resulting commit is created on the server side we need to get it from the server:
$ git pull --rebase
Now you should see
mod/a populated with the content of the shared code.
Remove a mapping¶
To remove a mapping remove the corresponding entry from the
The content of the previously shared path will stay in the workspace. That means the main
repo will have two copies of that path from that point on. Effectivly creating a fork of that code.
Remove a mapped path¶
To remove a mapped path as well as it’s contents, remove the entry from the
workspace.josh file and also remove the path inside the workspace using