Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • R3/school/courses
  • vilem.ded/courses
  • todor.kondic/courses
  • noua.toukourou/courses
  • nene.barry/courses
  • laurent.heirendt/courses
  • marina.popleteeva/courses
  • jenny.tran/courses
8 results
Show changes
Showing
with 168 additions and 0 deletions
2022/2022-06-07_git-trilogy-part-2/slides/img/clone-folder.png

201 KiB

2022/2022-06-07_git-trilogy-part-2/slides/img/clone.png

224 KiB

2022/2022-06-07_git-trilogy-part-2/slides/img/favicon.ico

39.9 KiB

2022/2022-06-07_git-trilogy-part-2/slides/img/fork.png

166 KiB

2022/2022-06-07_git-trilogy-part-2/slides/img/hero.png

69.1 KiB

../../../../2020/2020-03-30_basicGitTraining/slides/img/icon-live-demo.png
\ No newline at end of file
2022/2022-06-07_git-trilogy-part-2/slides/img/mergeCheck.png

175 KiB

2022/2022-06-07_git-trilogy-part-2/slides/img/mergePublishedBranch.png

100 KiB

2022/2022-06-07_git-trilogy-part-2/slides/img/mergeRepoBranches.png

218 KiB

2022/2022-06-07_git-trilogy-part-2/slides/img/publish.png

25.6 KiB

2022/2022-06-07_git-trilogy-part-2/slides/img/push.png

39.4 KiB

2022/2022-06-07_git-trilogy-part-2/slides/img/r3-training-logo.png

32.4 KiB

# R3.school
## June 7th, 2022
<div style="top: 6em; left: 0%; position: absolute;">
<img src="theme/img/lcsb_bg.png">
</div>
<div style="top: 5em; left: 60%; position: absolute;">
<img src="slides/img/r3-training-logo.png" height="200px">
<br><br><br><br>
<h1>Trilogy of git - Part II</h1>
<h2>Contribute using Visual Studio Code</h2>
<br><br><br>
<h4>
Laurent Heirendt, Ph.D.<br>
R3 Team - <a href="mailto:lcsb-r3@uni.lu">lcsb-r3@uni.lu</a><br>
<i>Luxembourg Centre for Systems Biomedicine</i>
</h4>
</div>
[
{ "filename": "index.md" },
{ "filename": "ide.md" },
{ "filename": "gui.md" },
{ "filename": "ssh.md" },
{ "filename": "workflow.md" },
{ "filename": "fork.md" },
{ "filename": "clone.md" },
{ "filename": "add-to-workspace.md" },
{ "filename": "branch.md" },
{ "filename": "commit.md" },
{ "filename": "push.md" },
{ "filename": "merge.md" },
{ "filename": "best_practices.md" },
{ "filename": "thanks.md" }
]
# Merge your changes to original repository via **Merge Request**
Now your changes are in your fork on the server.
If you want to incorporate your work into original (upstream) repository, submit a **Merge Request** via the Gitlab interface.
- If you just published branch, click "Create merge request"
<center>
<img width="30%" src="slides/img/mergePublishedBranch.png">
</center>
- If the button does not show up, go to `Repository > Branches` and click on `Merge request` for the branch you want to merge.
<center>
<img width="50%" src="slides/img/mergeRepoBranches.png">
</center>
# Merge your changes to original repository via **Merge Request**
- Make sure you are merging the *new* branch from **your fork** to the *develop* branch in **original repository**
<center>
<img height="130px" src="slides/img/MRwrong.png">
<img height="130px" src="slides/img/MRright.png">
</center>
- Give a meaningful title (start with "Draft:" if you are planning to continue work on this feature).
- Tick `Delete source branch when merge request is accepted.`
<center>
<img height="430px" src="slides/img/mergeCheck.png">
</center>
\ No newline at end of file
# Save your changes to server - push them
Your changes are saved and committed locally.
You need to save them on server. In git jargon: you need to *push them into your fork*.
2 scenarios:
- If you created branch locally, it does not exist yet on the server. You need to click on `Publish Branch` first:
<img height="230px" src="slides/img/publish.png">
For all future changes or when the branch already existed, click on `Sync changes`:
<img height="330px" src="slides/img/push.png">
\ No newline at end of file
# Key-based authentication
When communicating with the Gitlab server, you need credentials (username and password). Disadvantage: you have to enter the password every time.
Better: identify your laptop once, and then you do not need to enter the credentials anymore.
You need to do this setup just once (and repeat if you change your computer).<br>
- Open VS code
- Browse to `Terminal` > `New Terminal`
- Type this command at the command prompt: `ssh-keygen -t ed25519 -C firstname.lastname@uni.lu`
- Accept the suggested filename and directory (press `Enter`):
```
Generating public/private ed25519 key pair.
Enter file in which to save the key (/home/user/.ssh/id_ed25519):
```
- Press `Enter` (entering the passphrase is optional).
# Key-based authentication
A public and private key are generated and stored in specific location on your laptop. Now you need to add the public key to your GitLab account:
Copy the contents of your public key file:
- macOS: `tr -d '\n' < ~/.ssh/id_ed25519.pub | pbcopy`
- Windows: `cat ~/.ssh/id_ed25519.pub | clip`
Now, let's move to GitLab https://gitlab.lcsb.uni.lu/
- On the top bar, in the top right corner, select your avatar, then `Preferences`.
<center>
<img height="200px" src="slides/img/addSSHavatar.png">
</center>
# Key-based authentication
- On the left side, select **SSH Keys**.
- In the **Key** box, paste the copied public key. Make sure it starts with *ssh-ed25519* and finishes with your e-mail.
- In the **Title** box, type a description, like *Work Laptop*.<br>
<center>
<img width="60%" src="slides/img/addSSH.png">
</center>
# Key-based authentication
Verify that you connect by typing in the Terminal of VS code:
```bash
ssh -p 8022 -T git@gitlab.lcsb.uni.lu
```
The first time, you have to enter `Yes` at the displayed question. Once successful, this should display something like:
```bash
$ ssh -p 8022 -T git@gitlab.lcsb.uni.lu
Welcome to GitLab, @firstname.lastname
```
\ No newline at end of file
# Thank you.
<center><img src="slides/img/r3-training-logo.png" height="200px"></center>
Contact us if you need help:
<a href="mailto:lcsb-r3@uni.lu">lcsb-r3@uni.lu</a>
# Typical workflow (revisited)
- Create your own copy of the original (also called `upstream`) repository (`fork` in `git` jargon)
- Download your copy to your computer (`clone` in `git` jargon)
- Create a new branch
- Make changes
- Commit changes
- <font color="red">Push changes to server</font>
- Create merge request to upstream repository
<center>
<img width="60%" src="slides/img/fork_branch-diagram-after-commit-with-back-arrow.png">
</center>
\ No newline at end of file