# Collaborate on a LAB
In the following screenshots:
- `StudentA` is `abernier`
- `StudentB` is `elok6`
## Setup
1. `StudentA` forks the Ironhack's repository:

2. `StudentA` adds `StudentB` as a collaborator:




NB: here and optionally, `StudentA` can **copy the invitation link** and send it to `StudentB`: otherwise, studentB will receive an invitation by email
3. `StudentB` accepts the invitation (email or link sent)
3. **Both** can now clone the shared `StudentA`'s fork:

```sh
$ git clone https://github.com/abernier/lab-javascript-functions-and-arrays.git
```
Both can `push` and `pull` to it.
## Workflow
:point_right: Designate who is going to be the **driver / navigator** for Iteration 1
### Iteration 1
1. The **driver shares his screen** so the other one can help him:

2. Work together...
3. Once completed, driver does his commit and push:
```shell
$ git status
$ git add …
$ git commit -m "1st iteration done"
$ git push origin master
```
**The other one** retrieves the work by pulling:
```shell
$ git pull
```
### Iteration 2
- Switch driver / navigator.
- repeat iteration 1's steps
and so on...
## End of LAB
1. Even if you haven't finished, commit+push your last changes:
```shell
$ git status
$ git add …
$ git commit -m "iteration 4 work-in-progress"
$ git push origin master
```
2. `StudentA` (the one who has forked) do the Pull-Request:

## After the LAB
If you hadn't finished the LAB during class-time, 2 options then:
- continue working **together**
- finishing the LAB each on your side, **independently**
### Together
During extra-time `StudentA` and `StudentB` call themself on Zoom and continue working on, with the same workflow...
### Independently
#### `StudentA`
He continues to work on his fork: commits he pushes will be appended to the PR
#### `StudentB`
He has no fork :cry: (yet). In order he's got his own copy, he's going to fork `StudentA`'s fork:

That way `StudentB` **now has his own copy** with all the commits pushed during the LAB.
:::warning
Don't forget to **clone your own fork**! Here are the steps :
1. Remove `StudentA`'s clone:
```shell
$ rm -rf lab-javascript-functions-and-arrays
```
2. Clone your own fork
```
$ git clone https://github.com/elok6/lab-javascript-functions-and-arrays.git
$ cd lab-javascript-functions-and-arrays
$ code .
```
:::
Then code and commit + push on your own fork.