Skip to content
Snippets Groups Projects
Commit 554964d3 authored by Kaan Cimir's avatar Kaan Cimir
Browse files

Merge branch 'jt-gitober-part2' into 'develop'

gitober part2

See merge request R3/school/courses!183
parents f37d73bc 6fdfb743
No related branches found
No related tags found
1 merge request!183gitober part2
Pipeline #79011 passed
Showing
with 125 additions and 0 deletions
# Add an already locally existing repository to workspace
![bulb](slides/img/bulb.png) If you already have downloaded a repository, you can add it to VS code by following:
- Go to **File > Add Folder to Workspace**
<center>
<img width="30%" src="slides/img/add-root-folder.png">
</center>
\ No newline at end of file
# Best practices
* 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)**
* Get your code **reviewed** by your peers (submit a merge request!)
* Submit a merge request **often**! (as soon as the feature is ready)
* Make commits often (keeps increments small)
# Create a new branch
As part of the workflow, create a branch before starting to work.
- Click on branch symbol (bottom left)
<img height="100px" src="slides/img/branch.png">
- Choose "+ Create New Branch from..."
- Give the name to your new branch
- Select `origin/develop`
<img src="slides/img/icon-live-demo.png" height="100px">
# Clone your fork
Every repository is on the server. If you want to contribute using VS code, you need to download it to your laptop.
In git jargon: you need you *clone your fork*:
- Go to your projects (top left corner with LCSB logo)
- Find **basic-practice-pages** project under your name (your fork)
- Press *Clone* and then *Clone with SSH*. URL will be in your clipboard now.
<img width="60%" src="slides/img/clone.png">
- Switch to VS Code. Go to `View` > `Command Palette` and type "clone"
# Clone your fork
- You will be asked for the URL of the remote repository (you have it in your clipboard now)
<img height="100px" src="slides/img/clone-SSH.png">
- and the place where to put files on your computer.
<img height="400px" src="slides/img/clone-folder.png">
- To start working, you can now click on "Add to workspace"
<img height="100px" src="slides/img/add-to-workspace.png">
# Make changes and commit them
When you change a file, save them by clicking on `File > Save` or by hitting a shortcut (`CTRL + S` or `Command + S`).
![bulb](slides/img/bulb.png) On the left side, observe the git icon.
<br>
To commit your changes:
1. Go to Source Control in Activity Bar
2. Stage all changes you want to commit (press +)
3. Describe your changes in commit message
4. Commit your changes (press "tick")
<img src="slides/img/icon-live-demo.png" height="100px">
\ No newline at end of file
# Fork the upstream repository
If you recently contributed to the upstream repository, please delete the fork and start over (`Settings` > `General` > `Advanced` > `Delete project`)
<div class="fragment">
<br>
If you do not have write access to the `upstream` repository, you have to fork it (as seen in the previous course):
- make it `public` or `private` depending on upstream repository
- select your namespace
<center>
<img width="50%" src="slides/img/fork.png">
</center>
<img src="slides/img/icon-live-demo.png" height="100px"> Go to [https://gitlab.lcsb.uni.lu/R3/school/git/basic-practice-pages](https://gitlab.lcsb.uni.lu/R3/school/git/basic-practice-pages) and fork.
\ No newline at end of file
# Visual Studio Code - Graphical User Interface (GUI)
<img src="slides/img/icon-live-demo.png" height="100px"> GUI for VS code
<center>
<img src="slides/img/VSCodeGUI.png" width="60%">
</center>
# Visual Studio Code - Graphical User Interface (GUI)
- **Activity Bar** - Located on the left side, this lets you switch between views and gives you additional context-specific indicators, like the number of changes when Git is enabled.
- **Side Bar** - Contains information to assist while working on your project.
- **Editor** - The main area to edit files. You can open as many editors as you like side by side vertically and horizontally.
- **Panels** - You can display different panels below the editor region for output or debug information, errors and warnings, or an integrated terminal.
- **Status Bar** - Information about the opened project and the files you edit.
Source: VS code documentation
\ No newline at end of file
# Integrated development environment (IDE)
Most of you already know how to contribute to a repository directly online via Gitlab's Web IDE ([Trilogy of git, Part I](https://courses.lcsb.uni.lu/2022-05-31_git-trilogy-part-1/)).
However, Gitlab's Web IDE is rather limited if you want to:
- work efficiently
- work with several repositories at the same time
- work offline
- make changes to several documents all at once
- use find/replace features
- ...
In this course we will learn how to contribute to a common project working on you laptop via [Visual Studio Code](https://code.visualstudio.com/) (VS Code):
- Available for macOS, Linux, and Windows
- Open source (free)
- Easy to contribute using `git`
- Powerful tool and widely used
2023/2023-10-05_gitober-part2/slides/img/MRright.png

55.6 KiB

2023/2023-10-05_gitober-part2/slides/img/MRwrong.png

46.5 KiB

2023/2023-10-05_gitober-part2/slides/img/VSCodeGUI.png

104 KiB

2023/2023-10-05_gitober-part2/slides/img/add-root-folder.png

6.21 KiB

2023/2023-10-05_gitober-part2/slides/img/add-to-workspace.png

40.2 KiB

2023/2023-10-05_gitober-part2/slides/img/addFolder.png

51.2 KiB

2023/2023-10-05_gitober-part2/slides/img/addProject.png

146 KiB

2023/2023-10-05_gitober-part2/slides/img/addSSH.png

281 KiB

2023/2023-10-05_gitober-part2/slides/img/addSSHavatar.png

64.7 KiB

2023/2023-10-05_gitober-part2/slides/img/branch.png

21 KiB

../../../../2021/2021-03-18_basicGitTraining/slides/img/bulb.png
\ No newline at end of file
2023/2023-10-05_gitober-part2/slides/img/clone-SSH.png

34.8 KiB

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