Manual for Pijul
# Working with others

Although one can use Pijul to work alone, for instance to store the
history of changes of a project, or synchronise work with another
machine, it is mainly useful (and more efficient than other solutions)
when working with other people.

The only way to collaborate with others in Pijul is to send and
receive patches, and apply them to one's repository. When working on
an existing project, it might be necessary to *clone it* first. For
instance, in order to clone Pijul's main repository, you can run the
following command:

```
pijul clone https://nest.pijul.com/pijul/pijul
```

This just downloads all the patches currently in the remote
repository, applies them all, and outputs the result to a new working
copy. Further patch exchange can be done with the two commands `pull`
(receive patches) and `push` (send patches), as we explain now.


## Between local repositories

Patches can also be exchanged between local repositories, in both
directions (push and pull). As an example, let's create two
repositories, and exchange two patches between them:

```bash
mkdir a
cd a
pijul init
echo "blabla" > file
pijul add file
pijul record
cd ..

pijul clone a b
cd b
cat file # should contain "blabla"
echo "blibli" >> file
pijul record
pijul push ../a
echo "one extra line" >> file
pijul record

cd ../a
pijul pull ../b
```


## SSH

Pijul can work with remote repositories over SSH just like local
repositories.  **A working Pijul needs to be installed on the remote
machine, though.**

As an example, if you have an account called "me", and a repository
named "repo" under that account on nest.pijul.com, you can run for
instance:

```
pijul clone me@ssh.pijul.com:me/repo
```

To clone your repository, and:

```
pijul push me@ssh.pijul.com:me/repo
```

To send your local patches to your repository there. Just as with a
local repository, pulling patches can also be done over SSH:

```
pijul pull me@ssh.pijul.com:me/repo
```

## HTTP

Pijul is able to download patches from HTTP and HTTPS servers. In the
above example, receiving new patches from Pijul's main repository can
be done by running:

```
pijul pull https://nest.pijul.com/pijul/pijul
```

However, Pijul is not (yet) able to push patches to an HTTP URL.