syncFork.md 867 Bytes
Newer Older
1
2
3
4
5
6
7
8
9
## Synchronize your fork

![bulb](img/bulb.png) Remember, we have to regularly update our own copy of the code.


## Add the address of the original repository

Add the `upstream` address (original/protected repository)
```bash
Laurent Heirendt's avatar
Laurent Heirendt committed
10
$ git remote add upstream ssh://git@git-r3lab-server.uni.lu:8022/R3school/
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
  git.practice.git
```

![bulb](img/bulb.png) Note the change in the URL.


<br>
You can then check whether the remote address is set correctly
```bash
$ git remote -v
```

<div class="fragment">
<br>
Fetch the changes from upstream (similar to pull)
```bash
$ git fetch upstream
```

<div class="fragment">
<br>
Merge the retrieved changes on the `master` branch:
```bash
$ git checkout master
$ git merge upstream/master
$ git push origin master
```

<div class="fragment">
Laurent Heirendt's avatar
Laurent Heirendt committed
40
Do the same for the `develop` branch.
41

Laurent Heirendt's avatar
Laurent Heirendt committed
42
<img src="img/icon-live-demo.png" height="100px">