Skip to content
Snippets Groups Projects
Commit f2bc881d authored by Laurent Heirendt's avatar Laurent Heirendt :airplane:
Browse files

changes to slides

parent 3babbbb8
No related branches found
No related tags found
No related merge requests found
...@@ -4,11 +4,11 @@ ...@@ -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` * 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. * `clone` a repository, do not download the `.zip` file.
......
...@@ -27,91 +27,63 @@ A **version** of the code is referred to as a **branch**. ...@@ -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! ![bulb](img/bulb.png) Use this dual development scheme for your own repositories!
## Be safe! ## Branches
First, browse to the cloned practice directory: A **version** of the code (i.e., a **branch**) is made up of a sequence of code changes.
```bash
$ cd practice
```
Then, checkout the `develop` version of the code:
```bash
$ git checkout develop
```
<div class="fragment"> <div class="fragment">
<br> <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> For instance, the `master` and `develop` branches can be represented as a timeline:
```bash
$ git checkout -b first-branch
```
## Branches
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" /> <img src="img/branch-master.png" class="branch-master" />
## One branch per feature ## Switch between branches
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" />
Push the branch to the remote repository List all branches of the repository with
```bash ```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 ```bash
fatal: The current branch matrix_vect_mult_myName has no upstream branch. $ git checkout branchName
To push the current branch and set the remote as upstream, use
git push --set-upstream origin matrix_vect_mult_myName
``` ```
<div class="fragment">
<br> <br>
Follow the advice and do You can switch to the `develop` branch with
```bash ```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 Assume that you want to work on a function for multiplying 2 numbers.
```bash
$ git branch --list <font color="red">Create a new **branch**!</font>
```
<div class="fragment">
<br>
Checkout another branch
```bash ```bash
$ git checkout <branch_name> $ git checkout -b multiply-2-numbers
# creates the branch locally
``` ```
The `-b` flag creates the branch.
<div class="fragment"> <img src="img/branch-create.png" class="branch-create" />
<br>
You can switch back to the `master` branch with Push the branch to the remote repository
```bash ```bash
$ git checkout master $ git push origin multiply-2-numbers
``` ```
...@@ -121,47 +93,3 @@ You can use the 5 essential commands as before. ...@@ -121,47 +93,3 @@ You can use the 5 essential commands as before.
Only difference: you are on your own branch. Only difference: you are on your own branch.
<img src="img/branch-commit.png" class="branch-commit" /> <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 ## The 5 essential commands
<br> <br>
......
...@@ -55,8 +55,13 @@ $ git clone ssh://git@git-r3lab-server.uni.lu:8022/yourUserName/ ...@@ -55,8 +55,13 @@ $ git clone ssh://git@git-r3lab-server.uni.lu:8022/yourUserName/
git.practice.git practice git.practice.git practice
``` ```
<div class="fragment"> <br>
<br><br> Change to the practice directory with:
```bash
$ cd practice
```
<font color="red"> <font color="red">
Any other rudimentary method such as Any other rudimentary method such as
......
...@@ -71,6 +71,12 @@ ...@@ -71,6 +71,12 @@
"data-background": "img/whiteBG.jpg" "data-background": "img/whiteBG.jpg"
} }
}, },
{
"filename": "merge.md",
"attr": {
"data-background": "img/whiteBG.jpg"
}
},
{ {
"filename": "syncFork.md", "filename": "syncFork.md",
"attr": { "attr": {
......
merge.md 0 → 100644
## 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 ...@@ -38,12 +38,8 @@ $ git push origin master
<div class="fragment"> <div class="fragment">
<br> <br>
Merge the retrieved changes on the `develop` branch: Do the same for the `develop` branch<br>
```bash (replace `master` with `develop`).
$ git checkout develop
$ git merge upstream/develop
$ git push origin develop
```
## Time to practice! ## 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: [1]: **Git** Book:
https://git-scm.com/book/en/v2 https://git-scm.com/book/en/v2
<br>[2]: GitHub training services: https://services.github.com/training/ <br>[2]: GitHub training services: https://services.github.com/training/
<br>[3]: Cheat sheet: http://rogerdudler.github.io/git-guide
### Cheat sheet
[Web](http://rogerdudler.github.io/git-guide/index.html) or [PDF](http://rogerdudler.github.io/git-guide/files/git_cheat_sheet.pdf)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment