Verified Commit 490f3905 authored by Laurent Heirendt's avatar Laurent Heirendt
Browse files

add slides

parent 8299ebae
# Best practices
* Fetch the upstream before creating a new branch.
* Work on your <font color="red">own</font> branch (in your own fork), and **not** on `master` and **not** on `develop`
* Get your code **reviewed** by your peers (submit a PR!)
* Submit a PR **often**!
* `Push` often - avoid conflicts
Remember: **A `push` a day keeps conflicts away!**
# Development scheme
Generally, in a repository, there are guidelines for contributing.
<div class="fragment">
A common development scheme is dual with a:
- **development** version of the code on `develop`
- **stable** version of the code on `master`
A **version** of the code/text is referred to as a **branch**.
<div class="fragment">
<font color="red">In the `howto-cards-internal` repository, the development branch is called `develop`!</font>
<div class="fragment">
![bulb](slides/img/bulb.png) Use this dual development scheme for your own repositories!
# Branches
A **version** of the code (i.e., a **branch**) is made up of a sequence of code changes.
<div class="fragment">
These individual code changes are called **commits**.
For instance, the `master` and `develop` branches can be represented as a timeline:
<img src="slides/img/branch-master.png" class="branch-master" height="500em"/>
# Switch between branches
<img src="slides/img/icon-live-demo.png" height="100px">
# Create your own version
Assume that you want to work on a file:
<div class="fragment">
<font color="red">Create a new **branch** and start editing!</font>
<img src="slides/img/icon-live-demo.png" height="100px">
<img src="slides/img/branch-create.png" class="branch-create" height="500em"/>
# How to configure `git`?
```bash
$ git config --global user.name "Firstname Lastname"
$ git config --global user.email "first.last@uni.lu"
```
Test whether your username and email have been registered
```bash
$ git config --list
```
This should list the configuration with `user.name` and `user.email`.
# What is an SSH key?
An SSH key is a secure access credential.
**Principle**: <br><br>
Communicate **securely** with Github/Gitlab **without** entering the username/password.
# How do I get and set my SSH key?
Check if you already have an SSH key:
```bash
$ ls -al ~/.ssh
```
If there are 2 files named `id_rsa`, you have an SSH key.
If you don’t have yet an SSH key, you have to generate one:
```bash
$ ssh-keygen -t rsa # -b 4096
```
Then, add the SSH key to your profile on git-r3lab.
On Windows, please unmount `P:\` (your personal atlas folder) first.
<img src="slides/img/icon-live-demo.png" height="100px">
\ No newline at end of file
# What is a `fork`?
<br><br>
<center><img src="slides/img/fork.jpg" class="as-is" height="500em"/></center>
<!--http://www.cndajin.com/data/wls/246/22302193.jpg-->
# Not really ...
<br><br>
<center><img src="slides/img/fork-crossed.png" class="as-is" height="500em"/></center>
# What is a `fork`?
- In general, when contributing to a repository, you only have **read** access.
- In other words, you can only **pull** (unless it is your own repository or access has been granted).
- In general, you **cannot write** changes. In other words, you do not have **push** access.
- You have to work on your **own copy**.
- In other words, you have to work on your own <font color="red">**fork**</font>.
<br>
<h2>How to get a fork?</h1>
Browse to the original repository and click on the button `Fork`:
![Fork the repo](https://help.github.com/assets/images/help/repository/fork_button.jpg)
# How to update my fork?
As you have your own fork, it will not automatically be updated once the original repository is updated.
![bulb](slides/img/bulb.png) You have to update it yourself!
<img src="slides/img/icon-live-demo.png" height="100px">
**More on that during the demo!**
# Time to practice!
Fork the howto-cards (internal) repository: <br><br>
https://git-r3lab.uni.lu/R3-core/howto-cards-internal/
<img src="slides/img/icon-live-demo.png" height="100px">
\ No newline at end of file
# GitHub and GitLab
<img src="https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png" alt="GitHub" style="width: 200px;"/>
<img src="https://gitlab.com/gitlab-com/gitlab-artwork/raw/master/logo/logo-extra-whitespace.png" alt="GitLab" style="width: 200px;"/>
GitHub and GitLab are online platforms for developing code using the version control system (VCS) `git`.
Positive point: GitHub and GitLab are (almost) the same.
<img src="slides/img/icon-live-demo.png" height="100px">
- **GitHub**: [https://github.com](https://github.com)
- **GitLab**: [https://gitlab.com](https://gitlab.com)
At the LCSB, we use our own instance of Gitlab: [https://git-r3lab.uni.lu](https://git-r3lab.uni.lu)
\ No newline at end of file
......@@ -9,7 +9,7 @@
<div style="top: 5em; left: 60%; position: absolute;">
<img src="slides/img/r3-training-logo.png" height="200px">
<br><br><br>
<h1>git training for Biotech team</h1>
<h1>git training for biotech team</h1>
<br><br><br><br>
<h4>
Laurent Heirendt, Ph.D.<br>
......
# Merge requests
If you want your changes to be reflected on the `develop` or `master` branches,
**submit a MR** via the Gitlab interface.
Use the **interface** to make use of your peers to review your code!
<img src="slides/img/branch-merge.png" class="branch-merge" height="500em"/>
Once merged, you can delete the branch via the interface.
<div class="fragment">
<img src="slides/img/icon-live-demo.png" height="100px" >
\ No newline at end of file
# Overview
0. Subject 1
1. Subject 2
1. Introduction 📚
1. What is `git`? What is the use of `git`? 📚
2. GitHub and GitLab 📚
2. Installation & set up
- Configure git 💻
- Configure an SSH key 💻
3. Before starting to contribute to a repository
- What is a fork? 📚
- Create and clone a fork 💻
4. Contributing to a repository
- What are branches? 📚
- Create a branch 💻
- Create and edit a new card 💻
5. Submit the contribution for review
- What is a merge request? 📚
- Submit a merge request 💻
- Review a merge request 💻
6. Summary 📚
\ No newline at end of file
# Let's refresh our memories
<div class="fragment">
- What is a **fork**?
<div class="fragment">
- What are **branches**?
<div class="fragment">
- Can I have **multiple branches** in my fork?
<div class="fragment">
- What is a good **development scheme**?
# Thank you.
<center><img src="slides/img/r3-training-logo.png" height="200px"></center>
<img src="slides/img/r3-training-logo.png" height="200px">
Contact us if you need help:
<a href="mailto:r3lab.core@uni.lu">r3lab.core@uni.lu</a>
r3lab.core@uni.lu
# What is `git`? (i)
<!-- ![](slides/img/git_definition.png) -->
`git` is a **version control system** (VCS) for tracking changes in computer files and coordinating work on those files among multiple people [1].
Designed and implemented in 2005 by **Linus Torvalds**
<div align="center">
<img src="slides/img/linus.jpg">
</div>
[1] *https://en.wikipedia.org/wiki/Git*
# What is `git`? (ii)
<div align="center">
<img src="slides/img/git_definition.png">
</div>
`I'm an egotistical bastard, and I name all my projects after myself.
First Linux, now git.`
<br>
Linus Torvald (2007-06-14)
# What is the use of `git`?
* `git` can be used for code or text documents, such as markdown language
* No need to fully rewrite code/text; **reuse code/text** and **save time**
* Keep the changes you made over time (**history**)
* Allows you to **backtrack** (if necessary) and undo unwanted changes
* Easily **add contributions** of your collaborators to the main repository
<br>
Other points:
- `git` shall not be considered as a nuisance, but as a tool that should help to track and trace the code.
- `git` is not to track performance. Not using it shows exactly the opposite.
Markdown is supported
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