Git and GitLab Introduction

This note is a public workshop summary for learning Git and GitLab collaboration patterns.

Learning goals

  • Understand why version control is useful.
  • Practice local Git workflows.
  • Understand remote collaboration with GitLab or GitHub.

Why version control

  • Keep a clean and reviewable project history.
  • Revert to earlier states when needed.
  • Track line-level changes and context via commit messages.

Core local workflow

git init
git status
git add <files>
git commit -m "message"
git log
git diff

Basic collaboration workflow

git clone https://gitlab.example.com/<group>/<project>.git
git switch -c main
git add .
git commit -m "initial commit"
git push -u origin main

Connect existing local repository to a remote

git remote add origin https://gitlab.example.com/<group>/<project>.git
git push -u origin --all
git push -u origin --tags

Notes on safe public examples

  • Use placeholder domains and repository paths in documentation.
  • Avoid publishing institution-internal hostnames or private remotes.
  • Avoid local absolute file paths in shared notes.