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

Further changes to slides, essentially branches

parent e1f2321c
No related branches found
No related tags found
No related merge requests found
## Branches
Expérimentez en toute sécurité
Branch-off within the same repository in order to stay safe!
The master branch:
<img src="img/branch-0-master.png" class="as-is" />
## Une branche = Une fonctionnalité
## One branch per feature
Assume that you want to work on a function for a matrix-vector operation.
```shell
$ git checkout -b noel
$ git checkout -b matrix_vect_mult_myName
```
The `-b` flag creates the branch.
<img src="img/branch-1-checkout-b.png" class="as-is" />
## Navigation
## Switch between branches
Lister les branches
```shell
In your terminal, you may see the name of the branch you are on.
List available branches of the repository
```sh
$ git branch
```
Se positionner dans une branche
```shell
<div class="fragment">
<br>
Checkout another branch
```sh
$ git checkout <branch_name>
```
```shell
$ git commit
<div class="fragment">
<br>
You can switch back to master with
```sh
$ git checkout master
```
<img src="img/branch-2-commit.png" class="as-is" />
<div class="fragment">
<br>
You can use the 5 essential commands as before.
## Fusion
### En anglais, _merge_
Only difference: you are on your own branch.
```shell
$ git checkout master
$ git diff master..noel
$ git merge noel
```
<img src="img/branch-3-merge.png" class="as-is" />
## Merge a branch
If you want your feature on the `develop` or `master` branches, merge your branch with the
`develop` or `master` or branch:
## Nettoyage
<br>
**submit a MR or a PR** via the Github/Gitlab interface.
<!-- PICTURES HERE //-->
```shell
$ git branch -d noel
<div class="fragment">
<br>
**ADVANCED**: You can see the differences between branches
```sh
$ git diff master..matrix_vect_mult_myName
```
<img src="img/branch-4-br-d.png" class="as-is" />
<br>
You can delete the branch via the interface.
......@@ -32,30 +32,6 @@ $ git pull origin master # Récupérer le travail
Terminologie de l'application GitHub
## Avoid conflicts
## Pull/Merge Requests
Good practice:
<large>**PULL**</large> before you **push**!
Do **not** combine `git` commands
```sh
$ git commit -am "myMessage" # do not do this
```
Verify to have the right remote set on your fork
```sh
$ git remote -v
```
Keep your fork up-to-date
```sh
$ git fetch upstream
$ git merge upstream/master
$ git push origin master # do not do git push (!)
```
## Pull Requests
How to submit a Pull Request (PR)
How to submit a Pull or Merge Request (PR or MR)
......@@ -11,9 +11,3 @@ Positive point: GitHub and GitLab are (almost) the same.
## GitLab
## Good practices
Always `clone` a repository, do not download the `.zip` file.
......@@ -2,9 +2,12 @@
1. `clone` a repository, do not download the `.zip` file.
2. `pull` before `push`
3. Work on your own branch (in your own fork)
4. Do not `push` to `master`
5. Do not `push` to `develop`
3. Work on your **own** branch (in your own fork)
4. Do **not** `push` to `master` or `develop` (submit PR)
5. Do **not** combine `git` commands
```sh
$ git commit -am "myMessage" # do not do this
```
6. Stage only 1 file at once using
```sh
$ git add myFile.txt
......@@ -12,6 +15,12 @@ $ git add myFile.txt
7. Commit only a few files at once
8. Submit a PR instead of pushing directly
9. Always sync your fork before starting to work
```sh
$ 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 (!)
```
10. `Push` often - avoid conflicts
<br><br>
......
......@@ -62,9 +62,7 @@ $ git config -l
This should list the configuration with `user.name` and `user.email`.
## I need to get
<br>
##`The COBRAToolbox` - How?
## I need `The COBRAToolbox` - How?
Simply `clone` the repository (i.e., retrieve a copy)
```sh
......@@ -79,7 +77,7 @@ Any other rudimentary method such as
shall **be avoided**!
## How do I get any other repository?
## How do I `clone` any other repository?
You can clone any other repository with:
```sh
......
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