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

Merge branch 'git-training-slides' into april12

parents 4028507f 67dad01f
No related branches found
No related tags found
2 merge requests!23Regular merge of develop,!22Absolute Beginners workshop from April 12
...@@ -12,27 +12,20 @@ ...@@ -12,27 +12,20 @@
* `clone` a repository, do not download the `.zip` file. * `clone` a repository, do not download the `.zip` file.
* Do **not** combine `git` commands * Do **not** combine `git` commands
```bash ```bash
$ git commit -am "myMessage" # do not do this $ git commit -am "myMessage" # do not do this
``` ```
* Stage only 1 file at once using * Stage only 1 file at once using
```bash ```bash
$ git add myFile.txt $ git add myFile.txt
``` ```
* Commit **only a few files** at once (after multiple separate `git add` commands) * Commit **only a few files** at once (after multiple separate `git add` commands)
* Always **sync your fork** before starting to work on a new branch
```bash
$ git remote -v # verify to have the right remote set
$ git fetch upstream
$ git merge upstream/master
$ git push origin master # do not do git push (!)
```
* `Push` often - avoid conflicts * `Push` often - avoid conflicts
<br><br> <br><br>
......
...@@ -84,36 +84,6 @@ Use the **interface** to make use of your peers to review your code! ...@@ -84,36 +84,6 @@ Use the **interface** to make use of your peers to review your code!
Once merged, you can delete the branch via the interface. Once merged, you can delete the branch via the interface.
## Gitlab interface
<img src="https://gitlab.com/gitlab-com/gitlab-artwork/raw/master/logo/logo.png" alt="GitLab" style="width: 100px;"/>
Detailed information is on [docs.gitlab.com/ce/gitlab-basics/add-merge-request.html](https://docs.gitlab.com/ce/gitlab-basics/add-merge-request.html).
1. Click on **New merge request**
![New Merge Request](https://docs.gitlab.com/ee/gitlab-basics/img/merge_request_new.png)
<br><br>
2. Compare the branches
![Compare branches](https://docs.gitlab.com/ee/gitlab-basics/img/merge_request_select_branch.png)
<ol start="3">
<li>Assign your peer
<br>
![Assigning a peer](https://gitlab.com/gitlab-org/gitlab-ce/uploads/6445f80f96d8cb85b320322d36d8bb0e/assigneesidebar.png)
</li>
</ol>
<ol start="4">
<li>Submit the MR
![Submit MR](https://docs.gitlab.com/ee/gitlab-basics/img/merge_request_page.png)</li>
</ol>
## Github interface ## Github interface
<img src="https://assets-cdn.github.com/images/modules/logos_page/GitHub-Mark.png" alt="GitHub" style="width: 100px;"/> <img src="https://assets-cdn.github.com/images/modules/logos_page/GitHub-Mark.png" alt="GitHub" style="width: 100px;"/>
......
...@@ -36,6 +36,15 @@ $ git status ...@@ -36,6 +36,15 @@ $ git status
``` ```
## Be safe and create a new branch
(more on branches in a few minutes)
<br><br><br><br><br>
```bash
$ git checkout -b matrix_vect_mult_myName
```
## Modify a file ## Modify a file
Modify and rename `addTwoNumbers.m` in the folder `firstCommit` Modify and rename `addTwoNumbers.m` in the folder `firstCommit`
...@@ -81,7 +90,7 @@ $ git add firstCommit/addTwoNumbers_myName.m ...@@ -81,7 +90,7 @@ $ git add firstCommit/addTwoNumbers_myName.m
```bash ```bash
$ git diff $ git diff
``` ```
exit with `:q` exit with `q`
## Add a commit message ## Add a commit message
...@@ -112,10 +121,6 @@ $ git log ...@@ -112,10 +121,6 @@ $ git log
``` ```
exit by typing `q` exit by typing `q`
<div class="fragment">
<br><br>
You just pushed to `master`. This is **not a good** practice (more later!).
## Do it yourself ## Do it yourself
......
...@@ -21,5 +21,3 @@ Positive point: GitHub and GitLab are (almost) the same. ...@@ -21,5 +21,3 @@ Positive point: GitHub and GitLab are (almost) the same.
[https://git-r3lab.uni.lu](https://git-r3lab.uni.lu) [https://git-r3lab.uni.lu](https://git-r3lab.uni.lu)
<br><img src="https://gitlab.com/gitlab-com/gitlab-artwork/raw/master/logo/logo-extra-whitespace.png" alt="GitLab" style="width: 200px;"/> <br><img src="https://gitlab.com/gitlab-com/gitlab-artwork/raw/master/logo/logo-extra-whitespace.png" alt="GitLab" style="width: 200px;"/>
## Open an issue (Live Demo)
<img src="img/Git-Logo-Black.png" class="as-is" height="100px">training Absolute Beginners<br>
<br><br> <img src="img/Git-Logo-Black.png" class="as-is" height="100px"><br>Workshop
**SBG & MSP groups** <br>
<img src="img/logoLCSB.png" class="as-is" height="100px"> <img src="img/logoLCSB.png" class="as-is" height="100px">
<br><br><br><br> <br><br><br><br>
<br><br><br><br> <br>
January 19th, 2017 April 12th, 2017
Sylvain Arreckx & Laurent Heirendt Sylvain Arreckx & Laurent Heirendt
<br><br><br><br> <br><br><br><br>
note:
(**Tuesday**: verify that everybody has a working computer with git installed)
Verify that everyone has a GitHub and a Gitlab account
**Thursday**: interactive session
˜/work/training/cobratoolbox
1. Git (on GitHub and GitLab)
Init (git-r3 / graphique)
clone, add, commit, (diff, log), push and status
branch, checkout (add commit push on a branch)
Demo that if pushed to a branch, we will have a conflict -> submit a PR to DEVELOP from own branch to avoid that
2. Github
Explain interface
Fork, update the fork
PR, issues (on a dummy test repo)
**Thursday**: Home exercise (30 min)
- Task 1a: Create a function with documentation
- Task 1b: test
- Task 2: Push to forked repo and create a PR
- Bonus Task: Fork the cobratoolbox and update
- Friday: 1h debriefing
Put your speaker notes here.
You can see them pressing 's'.
Fullscreen can be activated by typing 'f'.
...@@ -73,7 +73,7 @@ $ git clone https://github.com/userName/myRepo.git myRepo ...@@ -73,7 +73,7 @@ $ git clone https://github.com/userName/myRepo.git myRepo
<br> <br>
Clone the training repository with Clone the training repository with
```bash ```bash
$ git clone https://git-r3lab.uni.lu/git-training/practice.git practice $ git clone https://github.com/uni-lu/practice.git practice
``` ```
<br> <br>
You may be prompted to enter your credentials. You may be prompted to enter your credentials.
...@@ -86,13 +86,3 @@ Any other rudimentary method such as ...@@ -86,13 +86,3 @@ Any other rudimentary method such as
shall **be avoided**! shall **be avoided**!
## I need `The COBRAToolbox`?
Simply `clone` the repository (i.e., retrieve a copy)
```bash
$ git clone https://github.com/opencobra/cobratoolbox.git cobratoolbox
```
<br><br>
**Do not** do it right now! Thank you.
...@@ -47,12 +47,6 @@ ...@@ -47,12 +47,6 @@
"data-background": "../img/whiteBG.jpg" "data-background": "../img/whiteBG.jpg"
} }
}, },
{
"filename": "forks.md",
"attr": {
"data-background": "../img/whiteBG.jpg"
}
},
{ {
"filename": "best_practices.md", "filename": "best_practices.md",
"attr": { "attr": {
...@@ -64,17 +58,5 @@ ...@@ -64,17 +58,5 @@
"attr": { "attr": {
"data-background": "../img/whiteBG.jpg" "data-background": "../img/whiteBG.jpg"
} }
},
{
"filename": "ready.md",
"attr": {
"data-background": "../img/whiteBG.jpg"
}
},
{
"filename": "homework.md",
"attr": {
"data-background": "../img/whiteBG.jpg"
}
} }
] ]
...@@ -7,7 +7,4 @@ ...@@ -7,7 +7,4 @@
4. The 5 essential commands <!--(10 min)//--> 4. The 5 essential commands <!--(10 min)//-->
* `pull` / `status` / `add` / `commit` / `push` * `pull` / `status` / `add` / `commit` / `push`
5. Branches <!--(10 min)//--> 5. Branches <!--(10 min)//-->
6. Forks <!--(10 min)//-->
7. Best practices 7. Best practices
8. Practical session <!--(40 min)//-->
9. Evaluation <!--(10 min)//-->
...@@ -11,6 +11,17 @@ ...@@ -11,6 +11,17 @@
<div align="left"><small>[1] *https://en.wikipedia.org/wiki/Git*</small></div> <div align="left"><small>[1] *https://en.wikipedia.org/wiki/Git*</small></div>
## Funny story
![](img/git_definition.png)
<br><br>
```
I'm an egotistical bastard, and I name all my projects after myself.
First Linux, now git.
```
Linus Torvald (2007-06-14)
## What is the use of `git`? ## What is the use of `git`?
* No need to fully rewrite code; **reuse code** and **save time** * No need to fully rewrite code; **reuse code** and **save time**
......
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