Skip to content
Snippets Groups Projects
Commit 6f0f652a authored by Mark HOEBEKE's avatar Mark HOEBEKE
Browse files

Merge branch 'git-basics' into 'main'

Update master with latest from Git Basics

See merge request !1
parents a0da93ec b4c7b7b2
No related branches found
No related tags found
1 merge request!1Update master with latest from Git Basics
......@@ -15,27 +15,28 @@ Training material for the Git for Beginners ABiMS training session
### Git Basics
1. Creating a repository
1. Default branches
1. Adding / Editing / Removing Files & Folders
1. Committing Changes
1. Adding / editing / removing files & folders
1. Committing changes
1. Pushing changes to the repository
### Branching Basics
1. Default branches
1. Creating new branches
1. Switching between branches
1. Merging branches
### Team Collaboration
### Team collaboration
1. Project roles in GitLab
1. Branch Protection
1. Submitting Merge Requests
1. Handling Merge Requests
1. Resolving Conflicts
### Using Git outside of GitLab
### Using Git through the command line
1. Configuring remote access to GitLab
1. Git Survival Memo (`fetch`, `update`)
1. Using Git from the Linux Command Line
### Using Git through third party tools
1. Using Git inside R-Studio
1. Using Git inside PyCharm
......
# Git Basics
## What's a repository ?
A repository is a hierarchy of folders (directories) to store your project files and folders *as well as additional files used by Git to keep track of all operations performed on your project files and folders*.
### Is each project stored in a single repository ?
Git is a distributed version management system. A specific project can be stored in multiple repositories. Usually, there is one reference repository used by all project contributors. All contributors have a local or work repository, which they initially cloned from the reference repository (more on this later).
## What's a Branch ?
In short: a branch is a name used to track the history of changes to files and folders over time, as a series of commits.
A repository can manage as many branches as needed (more on this later). When working on a Git project, there is always a *current* branch. Git provides operations to create/remove/switch between branches.
## What's a Commit ?
In short: a commit is a set of changes to files or folders that we want Git to keep track of, such as:
- Addition a file or folder
- Modification of the contents of a file
- Removal of a file or folder
- Renaming of a file or folder
Git provides operations to specify which files should be part of a commit.
## Create Your First Repository
### [Log In to GitLab](/git-basics/media/gitlab-login.mp4)
Log in to GitLab using your favourite account settings (GitLab, Google, GitHub, Twitter...)
![./media/gitlab_login.png](./media/gitlab_login.png)
### [Create a new Project](/git-basics/media/gitlab-create-project.mp4)
1. Select **Create a Project**
1. Select **Create Blank Project**
1. Give it a sensible name for a collection of animal descriptions
1. Keep the visibility **private**
1. Check the **Initialize repository with a README**
1. Select **Create Project**
![./media/gitlab_create_project.png](./media/gitlab_create_project.png)
### GitLab User Interface Main Panels
#### Project Summary Information
Recap with your project's name the number of _commits_, _branches_ (more on these soon) and _tags_ as well as storage space occupied by project files.
![./media/gitlab_project_info.png](./media/gitlab_project_info.png)
#### Current View and Most Recent Activity
Which _branch_ are we looking at ?
What was the most recent activity in this branch ?
![./media/gitlab_current.png](./media/gitlab_current.png)
#### Files / Folders in the Current View
Which files folders are part of the current _branch_ ?
If there's a `README.md` file, what's its contents ?
![./media/current_files.png](./media/current_files.png)
# Git Basics - Exercises
# Git Basics - Exercises
## Create your repository on GitLab
Log in to GitLab and create your repository (you can use the same name : _Animal Description Collection_)
## Use the Web IDE to add content
1. Pick one of birds, fish, insects, mammals, reptiles, imaginary and create a [Markdown](https://www.markdownguide.org/cheat-sheet/) file with the matching name (ex.: `imaginary.md`)
1. Add some contents to the file using the following format:
```
# Imaginary Animals Descriptions
## Gremlin
Name
: Gremlin
Color
: All kinds of
Biotope
: Mostly urban but can live anywhere
Comments
: Don't feed after midnight
## Totoro
Name
: Totoro
Color
: Grayish
Biotope
: My neighbors garden
Comments
: Can be quite vocal at times
```
1. Create an `images` folder
1. Add one or more images of the animals you described (grabbed from WikiPedia) to the `images` folder.
## Create your first commit
1. Use the `Create commit...` button of the Web IDE
1. Check the `Commit to main branch` button **This is a really bad practice we will never repeat once we know how to use branches.**
1. Enter a commit message explaining what changes you made
1. Click the `Commit` button.
git-basics/media/current_files.png

64.9 KiB

File added
File added
git-basics/media/gitlab_create_project.png

386 KiB

git-basics/media/gitlab_current.png

36.1 KiB

git-basics/media/gitlab_login.png

217 KiB

git-basics/media/gitlab_project_info.png

38 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