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

Merge branch 'lh-changes-git-part-1' into 'develop'

Changes for git part 1

See merge request !126
parents 45b1345b a82aa466
No related branches found
No related tags found
2 merge requests!129[release] Regular merge of develop,!126Changes for git part 1
Pipeline #57259 passed
Showing
with 132 additions and 413 deletions
# Wrap-up # Summary
* Git makes things separated but interlinked! GitLab creates a convenient and efficient working environment
* separation of changes into commits - compare with standard "versioning" of dropbox/onedrive/owncloud or labeling v1.2 manually - merge requests
* separation of work into branches - compare with standard work in parallel - making copy of file and renaming, then "putting it together" - issues
* separation of work into forks - compare with "I will make my own copy of the whole folder" - assignments
- much much more...
<div class="fragment">
* GitLab creates a convenient working environment # Best practices
* merge requests
* issues
* assignements
* and much much more...
<div style="position:absolute;left:55%;top:55%">
<img src="slides/img/fox.png">
https://pixabay.com/images/id-5236832/
</div>
</div>
# Wrap-up
## Glossary
* git
* repository
* fork
* commit
* branch
* merge
* merge/pull request
## Best practices
* 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 commit** to `master`/`develop`, but **submit a merge request (MR)** * Do **not commit** to `master`/`develop`, but **submit a merge request (MR)**
......
# New term: <font color="color:red">branch</font> # New term: <font color="color:red">branch</font>
* A sequence of commits (changes) is referred to as **branch**. * A sequence of commits (changes) is referred to as *branch*.
* A new branch can be created by __branching off__ from a commit. * A new branch can be created by *branching off* from a commit on another branch.
* A **branch** can be understood as a named **version** of your repository. * A *branch* can be understood as a named *version* of your repository.
<div style="position:absolute;left:50%;top:1em"> <div style="position:absolute;left:50%;top:1em">
<img src="slides/img/branch_branch-off_detail.png" class="as-is" height="800px"/> <img src="slides/img/branch_branch-off_detail.png" class="as-is" height="800px"/>
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
Generally, in a repository, there are guidelines for contributing. Generally, in a repository, there are guidelines for contributing.
<div class="fragment"> <br>
A common development scheme is dual with a: A common development scheme is dual with a:
...@@ -48,33 +48,39 @@ Best practice is to <font color="red">create a new **branch**!</font> ...@@ -48,33 +48,39 @@ Best practice is to <font color="red">create a new **branch**!</font>
<img src="slides/img/branch_my-branch.png" height="800em"/> <img src="slides/img/branch_my-branch.png" height="800em"/>
</div> </div>
<br> <br>
Using branches ensures: Using branches ensures:
* your changes are made separately from other changes * your changes are made separately from other (unrelated) changes
* your version won't be affected by others * your version will not be affected by other contributors
* all related changes are aggregated on one place * all related changes are aggregated in one place
* work can continue if the development of one feature gets stuck * work can continue if the development of one feature gets stuck
<br>
Are you working on more features in parallel? Are you working on more features in parallel?
<font color="red">Create a new **branch**!</font> for each of them :) <font color="red">Create a new **branch**!</font> for each of them!
# Quick recap
What is the difference between a *fork* and a *branch*?
# Time to practice! <div class="fragment">
<br><br><br>
<div align="center">
<img src="slides/img/forking_detail-with-branches.png" height="500em"/>
</div>
1. What is the difference between **fork** and **branch**?
<div class="fragment fade-in-then-out">
<div style="position:absolute;left:10%;top:8em">
<img src="slides/img/forking_detail-with-branches.png" height="500em"/>
</div>
2. Why is best practice to branch off from `develop`?
3. Switch between branches # How to switch between branches?
<div class="fragment fade-in-then-out">
<div style="position:absolute;left:10%;top:8em"> <div style="position:absolute;left:10%;top:8em">
<img src="slides/img/branch_GUI_switch.png" height="500em"/> <img src="slides/img/branch_GUI_switch.png" height="500em"/>
</div> </div>
Why is best practice to branch off from `develop`?
\ No newline at end of file
...@@ -4,17 +4,18 @@ ...@@ -4,17 +4,18 @@
* Every change moves the repository to a new state. * Every change moves the repository to a new state.
* Every change added to the sequence of changes is called **commit**. * Every change added to the sequence of changes is called **commit**.
* Every commit has: * Every commit has:
* message - why * content - what?
* author - who * a message - why?
* timestamp - when * an author - who?
* unique identifier * a timestamp - when?
* unique identifier - tracking number
<div style="position:absolute;left:60%;top:1em"> <div style="position:absolute;left:60%;top:1em">
<img src="slides/img/commit_history-diagram.png" class="as-is" height="800px"/> <img src="slides/img/commit_history-diagram.png" class="as-is" height="800px"/>
</div> </div>
<div class="fragment"> <div class="fragment">
Gitlab UI: Gitlab:
<div style="position:absolute"> <div style="position:absolute">
<img src="slides/img/commit_GUI_1.png" class="as-is" height="350px"/> <img src="slides/img/commit_GUI_1.png" class="as-is" height="350px"/>
</div> </div>
...@@ -23,9 +24,10 @@ Gitlab UI: ...@@ -23,9 +24,10 @@ Gitlab UI:
# New term: <font color="color:red">commit</font> # New term: <font color="color:red">commit</font>
## Time to practice!
1. Notice last commit on files <img src="slides/img/icon-live-demo.png" height="100px">
1. Notice last commits that modified files/folders
<!-- .element: class="fragment" data-fragment-index="1" --> <!-- .element: class="fragment" data-fragment-index="1" -->
1. Review history of your repository 1. Review history of your repository
<!-- .element: class="fragment" data-fragment-index="2" --> <!-- .element: class="fragment" data-fragment-index="2" -->
...@@ -45,10 +47,5 @@ Gitlab UI: ...@@ -45,10 +47,5 @@ Gitlab UI:
<img src="slides/img/commit_GUI_click-on-commit.png" class="as-is" height="75px"/> <img src="slides/img/commit_GUI_click-on-commit.png" class="as-is" height="75px"/>
</div> </div>
<div class="fragment fade-in-then-out" data-fragment-index="3"> <div class="fragment fade-in-then-out" data-fragment-index="3">
<img src="slides/img/commit_changes.png" class="as-is" height="600px"/> <img src="slides/img/commit_changes.png" class="as-is" width="90%"/>
</div> </div>
What is this
Notes:
Congrats! Now you have reviewed recent changes in your repository!
\ No newline at end of file
...@@ -20,18 +20,15 @@ ...@@ -20,18 +20,15 @@
# New term: <font color="color:red">fork</font> # New term: <font color="color:red">fork</font>
## What is a `fork`? ## What is a `fork`?
- In general, by default you can only **read** files in a repository. - In general, by default, you can only **read** files in a repository. You **cannot write**.
- In general, by default you **cannot write** changes.
<div class="fragment"> <div class="fragment">
<img src="slides/img/forking.png" height="400px"> <img src="slides/img/forking.png" height="400px">
- You have to work on your **own copy** of the repository - You have to work on your **own copy** of the repository in order to make changes.
- In other words, you have to work on your own <font color="red">**fork**</font>. - In other words, you have to work on your own <font color="red">**fork**</font>.
<br>
## Why?
...@@ -39,7 +36,9 @@ ...@@ -39,7 +36,9 @@
Browse to the original repository and click on the button `Fork`: Browse to the original repository and click on the button `Fork`:
<img src="https://docs.gitlab.com/ee/user/project/repository/img/forking_workflow_fork_button_v13_10.png" height="250px"> <div align="center">
<img src="https://docs.gitlab.com/ee/user/project/repository/img/forking_workflow_fork_button_v13_10.png" height="150">
</div>
<br> <br>
...@@ -48,19 +47,19 @@ Browse to the original repository and click on the button `Fork`: ...@@ -48,19 +47,19 @@ Browse to the original repository and click on the button `Fork`:
## Time to practice! ## Time to practice!
1. Fork the practice repository: <br><br> 1. Fork the training repository [https://gitlab.lcsb.uni.lu/R3/school/git/basic-practice-pages](https://gitlab.lcsb.uni.lu/R3/school/git/basic-practice-pages)
TODO<br><br>
Congrats! Now you have your own **fork**!
Congrats! Now you have your own **fork**!
# How to update my fork?
# How to update my fork? - TODO: move to the end or delete As you have your own copy (fork), it will not automatically be updated once the original repository is updated.
\
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! ![bulb](slides/img/bulb.png) You have to update it yourself!
<br> <br>
**More on that later!** **More on that later - time permitting**
# Git repository hosting platforms # Git repository hosting platforms
<div style="position:absolute; left:70%"> <div style="position:absolute; left:70%">
<img src="https://gitlab.com/gitlab-com/gitlab-artwork/raw/master/logo/logo-extra-whitespace.png" alt="GitLab" style="width: 500px;"/> <img src="https://gitlab.com/gitlab-com/gitlab-artwork/raw/master/logo/logo-extra-whitespace.png" alt="GitLab" style="width: 500px;"/>
</div> </div>
...@@ -22,22 +23,15 @@ Another popular platforms: ...@@ -22,22 +23,15 @@ Another popular platforms:
# Time to practice! # Login and report and issue
<img src="slides/img/icon-live-demo.png" height="100px">
1. Login to [https://gitlab.lcsb.uni.lu](https://gitlab.lcsb.uni.lu) 1. Login to [https://gitlab.lcsb.uni.lu](https://gitlab.lcsb.uni.lu)
* use your LUMS credentials * use your LUMS credentials
2. browse the existing repositories 2. Browse the existing repositories
* Explore -> * Explore and Search
* navigate to the training repository * Navigate to the training repository [https://gitlab.lcsb.uni.lu/R3/school/git/basic-practice-pages](https://gitlab.lcsb.uni.lu/R3/school/git/basic-practice-pages)
3. Inspect project/repository folder structure 3. Inspect project/repository folder structure
4. Discover an issue (see README.md) and report it 4. Report an issue
<div class="fragment"> <img src="slides/img/icon-live-demo.png" height="100px">
Congrats! You are a **reporter** :)
</div>
notes:
- reporter is very important role
2022/2022-05-31_git-trilogy-part-1/slides/img/commit_GUI_main.png

330 KiB

2022/2022-05-31_git-trilogy-part-1/slides/img/commit_changes.png

35.1 KiB | W: | H:

2022/2022-05-31_git-trilogy-part-1/slides/img/commit_changes.png

58.8 KiB | W: | H:

2022/2022-05-31_git-trilogy-part-1/slides/img/commit_changes.png
2022/2022-05-31_git-trilogy-part-1/slides/img/commit_changes.png
2022/2022-05-31_git-trilogy-part-1/slides/img/commit_changes.png
2022/2022-05-31_git-trilogy-part-1/slides/img/commit_changes.png
  • 2-up
  • Swipe
  • Onion skin
This diff is collapsed.
2022/2022-05-31_git-trilogy-part-1/slides/img/fox.png

434 KiB

2022/2022-05-31_git-trilogy-part-1/slides/img/icon-fork.png

4.96 KiB

2022/2022-05-31_git-trilogy-part-1/slides/img/merge_GUI_detail.png

58.1 KiB

2022/2022-05-31_git-trilogy-part-1/slides/img/merge_branch-to-branch.png

7.86 KiB

2022/2022-05-31_git-trilogy-part-1/slides/img/merge_changes.png

152 KiB

2022/2022-05-31_git-trilogy-part-1/slides/img/remote-local_architecture.webp

68.1 KiB

# Trilogy of Git Part 1 # R3.school
## May 31st, 2022 ## May 31st, 2022
...@@ -8,12 +8,13 @@ ...@@ -8,12 +8,13 @@
<div style="top: 5em; left: 60%; position: absolute;"> <div style="top: 5em; left: 60%; position: absolute;">
<img src="slides/img/r3-training-logo.png" height="200px"> <img src="slides/img/r3-training-logo.png" height="200px">
<br><br><br> <br><br><br><br>
<h1>Contribute using Gitlab</h1> <h1>Trilogy of git - Part I</h1>
<h2>Contribute using Gitlab</h2>
<br><br><br> <br><br><br>
<h4> <h4>
Laurent Heirendt<br><br> Laurent Heirendt, Ph.D.<br>
laurent.heirendt@uni.lu<br><br> R3 Team - <a href="mailto:lcsb-r3@uni.lu">lcsb-r3@uni.lu</a><br>
<i>Luxembourg Centre for Systems Biomedicine</i> <i>Luxembourg Centre for Systems Biomedicine</i>
</h4> </h4>
</div> </div>
\ No newline at end of file
# New term: <font color="color:red">merge</font> # New term: <font color="color:red">merge</font>
* You have made changes on your branch * You have made changes on your branch
* Now you want your changes to be reflected on another branch </br>(most probably `develop` or `master`) * Now you want your changes to be reflected on another branch </br>(most probably `develop`)
<div style="position:absolute;left:60%;top:1em"> <div style="position:absolute;left:70%;top:1em">
<img src="slides/img/branch_merge-detail.png" height="800px" > <img src="slides/img/branch_merge-detail.png" height="800px" >
</div> </div>
You have to <font color="color:red">merge</font> the branches. You have to <font color="color:red">merge</font> the branches.
**Remarks**: merging is directional - *Merge branch A to branch B* - Merging is directional - *Merge branch A to branch B*
- Merging of branches is a process that is initiated via a so called **merge request** (MR):
- Your peers can comment on your changes in a merge request **review**!
### The merge is initiated via so called **merge request**
* *Requesting* someone (from the original repository) to *merge* your changes.
* *merge request* is commonly abreviated as **MR**
Your peers can comment on your changes in a merge request **review**!
# What happened in the background?
<div style="position:absolute;top:2em" class="fragment fade-in-then-out" data-fragment-index="1">
# Our state at the moment?
<div style="position:absolute;top:2em" >
<img src="slides/img/fork_branch-diagram-after-commit.png" height="600px" > <img src="slides/img/fork_branch-diagram-after-commit.png" height="600px" >
</div> </div>
<div style="position:absolute;top:2em" class="fragment fade-in-then-out" data-fragment-index="1"> <div style="position:absolute;top:2em" class="fragment fade-in-then-out" data-fragment-index="1">
<img src="slides/img/fork_branch-diagram-after-commit-with-back-arrow.png" height="600px" > <img src="slides/img/fork_branch-diagram-after-commit-with-back-arrow.png" height="600px" >
</div> </div>
# Time to practice! # Merge request (MR)
* After hitting the Commit button, you get redirected to the submission page for your merge request <img src="slides/img/icon-live-demo.png" height="100px">
* Please make sure that you see that you are proposing to merge your branch (version) into the develop branch. This is shown at the top of the page:
<!-- .element: class="fragment" data-fragment-index="1" -->
* Fill your merge request submission form and select an Assignee.
<!-- .element: class="fragment" data-fragment-index="3" -->
* Good practice is to select Delete source branch when merge request is accepted. (Why?)
<!-- .element: class="fragment" data-fragment-index="4" -->
* Under Changes tab, you can see your... changes :)
<!-- .element: class="fragment" data-fragment-index="5" -->
After hitting the *Commit* button, you get redirected to the submission page for your *merge request (MR)*
<div style="position:absolute;left:30%;top:4em" class="fragment fade-in-then-out" data-fragment-index="1"> * Propose to merge your branch into the *development branch*. This is shown at the top of the page.
<img src="slides/img/merge_GUI_detail.png" height="720px" > * Fill your merge request submission form and select an *Assignee*.
</div> * Under Changes tab, you can see your changes
<div style="position:absolute;left:30%;top:6em" class="fragment fade-in-then-out" data-fragment-index="2">
<img src="slides/img/merge_branch-to-branch.png" height="100px" >
</div>
<div style="position:absolute;left:5%;top:10em" class="fragment fade-in-then-out" data-fragment-index="5"> ![bulb](slides/img/bulb.png) Good practice is to select *Delete source branch when merge request is accepted*. Why?
<img src="slides/img/merge_changes.png" height="400px" >
</div>
# Synchronize your fork # Synchronize your fork
<!-- TODO: do we need this slide? --> As mentioned earlier, your fork has been created a certain moment in time.
<!-- Should it contain steps for deleting a branch -->
\ No newline at end of file How to keep it updated?
## Easy way
Delete your fork and re-create it!
- Go to `Settings > General`
- Scroll down to the `Advanced` section and expand it
- Click on `Delete this project` and follow the on-screen instructions
![bulb](slides/img/bulb.png) Before you do this, please make sure that all your merge requests have been accepted.
## Automatic way
Follow the instructions on the How-To card: [https://howto.lcsb.uni.lu/?contribute:mirror-fork](https://howto.lcsb.uni.lu/?contribute:mirror-fork)
\ No newline at end of file
# Using versioning system? # Why use a version control system?
Basic feature: Basic feature:
* Ability to recover old versions
* Ability to recover old versions
<div class="fragment">
<div style="position:absolute; left:50%"> <div style="position:absolute; left:50%">
<img src="slides/img/version-history_OneDrive.png" height="650px"> <img src="slides/img/version-history_OneDrive.png" height="650px">
</div> </div>
...@@ -11,20 +11,22 @@ Basic feature: ...@@ -11,20 +11,22 @@ Basic feature:
Common tools you are already using supporting "version control": Common tools you are already using supporting "version control":
- Owncloud - Owncloud
- OneDrive - OneDrive
- DropBox
- ... - ...
Its clear **who** changed **which file** and **when** :) Huray! From the list of files, it is clear *who* changed which file and *when*.
<div class="fragment"> <div class="fragment">
### But something is missing, right? But some information is missing:
- **What exactly** was changed? (which section or row?)
- **Why** it was changed?
- *What exactly* was changed? (which section or row?)
- *Why* was it changed?
# Using versioning system?
# Why use a version control system?
## Manual file versioning + CHANGELOG ## Manual file versioning + CHANGELOG
<br> <br>
...@@ -73,7 +75,9 @@ note: overhead for doing this manually is huge ...@@ -73,7 +75,9 @@ note: overhead for doing this manually is huge
# Using versioning system? # Using versioning system?
What happens if **3** people contribute?
What happens when **3** people contribute?
``` ```
my-document_v01_AK.docx my-document_v01_AK.docx
my-document_v01_AK_BP.docx my-document_v01_AK_BP.docx
...@@ -87,14 +91,4 @@ CHANGELOG.txt ...@@ -87,14 +91,4 @@ CHANGELOG.txt
<div class="fragment"> <div class="fragment">
What happens when **10** people contribute? What happens when **10** people contribute?
``` \ No newline at end of file
_ ._ _ , _ ._
(_ ' ( ` )_ .__)
( ( ( ) `) ) _)
(__ (_ (_ . _) _) ,__)
`~~`\ ' . /`~~`
; ;
/ \
_____________/_ __ \_____________
```
# Time to practice! # Workflow - Web IDE
To change content of a file: To change content of a file:
* Browse to *your fork*
* Open Web IDE * Open Web IDE
<!-- .element: class="fragment" data-fragment-index="1" --> <!-- .element: class="fragment" data-fragment-index="1" -->
* Select a branch you want to work on * Select the development branch
<!-- .element: class="fragment" data-fragment-index="2" --> <!-- .element: class="fragment" data-fragment-index="2" -->
* Edit file content * Edit file content
<!-- .element: class="fragment" data-fragment-index="3" --> <!-- .element: class="fragment" data-fragment-index="3" -->
* Commit * Commit
<!-- .element: class="fragment" data-fragment-index="4" --> <!-- .element: class="fragment" data-fragment-index="4" -->
* Hit Commit * Click Commit
* Select **Create a new branch** and type your branch name * Select **Create a new branch**
* Leave the **Start a new merge request** checked * Type your branch name (optional, but recommended)
* Hit Commit * Check **Start a new merge request**
* Click Commit
<div style="position:absolute;left:40%;top:1em" class="fragment fade-in-then-out" data-fragment-index="1"> <div style="position:absolute;left:30%;top:1em" class="fragment fade-in-then-out" data-fragment-index="1">
<img src="slides/img/commit_GUI_web-ide.png" height="600px" > <img src="slides/img/commit_GUI_web-ide.png" width="90%" >
</div> </div>
<div style="position:absolute;left:40%;top:1em" class="fragment fade-in-then-out" data-fragment-index="2"> <div style="position:absolute;left:40%;top:1em" class="fragment fade-in-then-out" data-fragment-index="2">
<img src="slides/img/web-ide_select-branch.png" height="600px" > <img src="slides/img/web-ide_select-branch.png" width="90%" >
</div> </div>
<div style="position:absolute;left:33%;top:1em" class="fragment fade-in-then-out" data-fragment-index="3"> <div style="position:absolute;left:33%;top:1em" class="fragment fade-in-then-out" data-fragment-index="3">
<img src="slides/img/web-ide_edit-file.png" height="400px" > <img src="slides/img/web-ide_edit-file.png" width="90%" >
</div> </div>
<div style="position:absolute;left:50%;top:1em" class="fragment fade-in-then-out" data-fragment-index="4"> <div style="position:absolute;left:50%;top:1em" class="fragment fade-in-then-out" data-fragment-index="4">
<img src="slides/img/web-ide_commit-button.png" height="200px" > <img src="slides/img/web-ide_commit-button.png" width="90%" >
</div> </div>
<div style="position:absolute;left:50%;top:10em" class="fragment fade-in-then-out" data-fragment-index="4"> <div style="position:absolute;left:50%;top:10em" class="fragment fade-in-then-out" data-fragment-index="4">
<img src="slides/img/web-ide_commit-detail.png" height="400px" > <img src="slides/img/web-ide_commit-detail.png" width="90%" >
</div>
# What have we done?
<div style="position:absolute;top:2em" class="fragment fade-in-then-out" data-fragment-index="1">
<img src="slides/img/fork_branch-diagram-after-commit.png" height="600px" >
</div> </div>
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