Commit f2bc881d authored by Laurent Heirendt's avatar Laurent Heirendt
Browse files

changes to slides

parent 3babbbb8
......@@ -4,11 +4,11 @@
* Work on your <font color="red">own</font> branch (in your own fork), and **not** on `master` and **not** on `develop`
* Do **not push** to `master` or `develop`, but **submit a PR**
* Do **not push** to `master` or `develop`, but **submit a PR/MR**
* Get your code **reviewed** by your peers (submit a PR!)
* Get your code **reviewed** by your peers (submit a PR/MR!)
* Submit a PR **often**!
* Submit a PR/MR **often**!
* `clone` a repository, do not download the `.zip` file.
......
......@@ -27,91 +27,63 @@ A **version** of the code is referred to as a **branch**.
![bulb](img/bulb.png) Use this dual development scheme for your own repositories!
## Be safe!
## Branches
First, browse to the cloned practice directory:
```bash
$ cd practice
```
Then, checkout the `develop` version of the code:
```bash
$ git checkout develop
```
A **version** of the code (i.e., a **branch**) is made up of a sequence of code changes.
<div class="fragment">
<br>
Then, <font color="red">create a new **branch**!</font>
These individual code changes are called **commits**.
(more details on **branches** in a few minutes)
<br>
```bash
$ git checkout -b first-branch
```
## Branches
For instance, the `master` and `develop` branches can be represented as a timeline:
Branch-off within the same repository in order to stay safe!
<br><br>The master branch
<img src="img/branch-master.png" class="branch-master" />
## One branch per feature
Assume that you want to work on a function for a matrix-vector operation.
```bash
$ git checkout -b matrix_vect_mult_myName
# creates the branch locally
```
The `-b` flag creates the branch.
<img src="img/branch-create.png" class="branch-create" />
## Switch between branches
Push the branch to the remote repository
List all branches of the repository with
```bash
$ git push
$ git branch -a
```
Exit by typing `q`. The branch with the ***** is the current branch.
If you do that, `git` might complain
<div class="fragment">
<br>
Checkout another branch
```bash
fatal: The current branch matrix_vect_mult_myName has no upstream branch.
To push the current branch and set the remote as upstream, use
git push --set-upstream origin matrix_vect_mult_myName
$ git checkout branchName
```
<div class="fragment">
<br>
Follow the advice and do
You can switch to the `develop` branch with
```bash
$ git push --set-upstream origin matrix_vect_mult_myName
$ git checkout develop
```
(Live Demo)
## Switch between branches
In your terminal, you may see the name of the branch you are on.
## Create your own version
List available branches of the repository
```bash
$ git branch --list
```
Assume that you want to work on a function for multiplying 2 numbers.
<font color="red">Create a new **branch**!</font>
<div class="fragment">
<br>
Checkout another branch
```bash
$ git checkout <branch_name>
$ git checkout -b multiply-2-numbers
# creates the branch locally
```
The `-b` flag creates the branch.
<div class="fragment">
<br>
You can switch back to the `master` branch with
<img src="img/branch-create.png" class="branch-create" />
Push the branch to the remote repository
```bash
$ git checkout master
$ git push origin multiply-2-numbers
```
......@@ -121,47 +93,3 @@ You can use the 5 essential commands as before.
Only difference: you are on your own branch.
<img src="img/branch-commit.png" class="branch-commit" />
## Merge a branch
If you want your feature on the `develop` or `master` branches,
**submit a MR or a PR** via the Github/Gitlab interface.
<br>
Use the **interface** to make use of your peers to review your code!
<img src="img/branch-merge.png" class="branch-merge" />
<br>
Once merged, you can delete the branch via the interface.
## Github interface
<img src="https://assets-cdn.github.com/images/modules/logos_page/GitHub-Mark.png" alt="GitHub" style="width: 100px;"/>
Detailed information is on [help.github.com/articles/creating-a-pull-request/](https://help.github.com/articles/creating-a-pull-request/).
1. Click on **New pull request**
![New pull request](https://help.github.com/assets/images/help/pull_requests/pull-request-start-review-button.png)
<br><br>
2. Compare the branches
![Compare branches](https://help.github.com/assets/images/help/pull_requests/choose-base-and-compare-branches.png)
<ol start="3">
<li>Assign your peer
<br>
![Assigning a peer](https://help.github.com/assets/images/help/issues/issues_assigning_dropdown.png)
</li>
</ol>
<ol start="4">
<li>Submit the PR
![Submit MR](https://help.github.com/assets/images/help/pull_requests/pullrequest-send.png)</li>
</ol>
## The 5 essential commands
<br>
......
......@@ -55,8 +55,13 @@ $ git clone ssh://git@git-r3lab-server.uni.lu:8022/yourUserName/
git.practice.git practice
```
<div class="fragment">
<br><br>
<br>
Change to the practice directory with:
```bash
$ cd practice
```
<font color="red">
Any other rudimentary method such as
......
......@@ -71,6 +71,12 @@
"data-background": "img/whiteBG.jpg"
}
},
{
"filename": "merge.md",
"attr": {
"data-background": "img/whiteBG.jpg"
}
},
{
"filename": "syncFork.md",
"attr": {
......
## Merge a branch
If you want your feature on the `develop` or `master` branches,
**submit a MR or a PR** via the Github/Gitlab interface.
<br>
Use the **interface** to make use of your peers to review your code!
<img src="img/branch-merge.png" class="branch-merge" />
<br>
Once merged, you can delete the branch via the interface.
## Github interface
<img src="https://assets-cdn.github.com/images/modules/logos_page/GitHub-Mark.png" alt="GitHub" style="width: 100px;"/>
Detailed information is on [help.github.com/articles/creating-a-pull-request/](https://help.github.com/articles/creating-a-pull-request/).
1. Click on **New pull request**
![New pull request](https://help.github.com/assets/images/help/pull_requests/pull-request-start-review-button.png)
<br><br>
2. Compare the branches
![Compare branches](https://help.github.com/assets/images/help/pull_requests/choose-base-and-compare-branches.png)
<ol start="3">
<li>Assign your peer
<br>
![Assigning a peer](https://help.github.com/assets/images/help/issues/issues_assigning_dropdown.png)
</li>
</ol>
<ol start="4">
<li>Submit the PR
![Submit MR](https://help.github.com/assets/images/help/pull_requests/pullrequest-send.png)</li>
</ol>
......@@ -38,12 +38,8 @@ $ git push origin master
<div class="fragment">
<br>
Merge the retrieved changes on the `develop` branch:
```bash
$ git checkout develop
$ git merge upstream/develop
$ git push origin develop
```
Do the same for the `develop` branch<br>
(replace `master` with `develop`).
## Time to practice!
......
### References
### Let's refresh our memories
<div class="fragment">
<br>
- What is a **fork**?
<div class="fragment">
<br>
- What are **branches**?
<div class="fragment">
<br>
- Can I have **multiple branches** in my fork?
<div class="fragment">
<br>
- What is a good **development scheme**?
<div class="fragment">
<br>
- What are the **5 essential commands**?
### References & Cheat sheet
[1]: **Git** Book:
https://git-scm.com/book/en/v2
<br>[2]: GitHub training services: https://services.github.com/training/
### Cheat sheet
[Web](http://rogerdudler.github.io/git-guide/index.html) or [PDF](http://rogerdudler.github.io/git-guide/files/git_cheat_sheet.pdf)
<br>[3]: Cheat sheet: http://rogerdudler.github.io/git-guide
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment