Master Git & GitLab

Learn version control from scratch. Interactive tutorials, hands-on exercises, and real-world GitLab workflows.

Your Progress 0%

📦 Git Basics

🚀

git init

Initialize a new Git repository in your project folder.

Not Started

git add

Stage changes for commit. Tell Git which files to track.

Not Started
💾

git commit

Save your staged changes with a descriptive message.

Not Started
⬆️

git push

Upload your commits to a remote repository.

Not Started
⬇️

git pull

Download and merge changes from a remote repository.

Not Started
🌿

git branch

Create, list, or delete branches for parallel development.

Not Started
🔀

git merge

Combine changes from different branches together.

Not Started
📥

git clone

Copy an existing repository to your local machine.

Not Started

📚 Your First Git Project

Step 1: Configure Git

Before starting, set up your identity:

Bash
git config --global user.name "Your Name" git config --global user.email "your@email.com"

Step 2: Initialize a Repository

Create a new folder and turn it into a Git repo:

Bash
mkdir my-project cd my-project git init

Step 3: Make Changes & Commit

Create a file, stage it, and commit:

Bash
echo "Hello World" > hello.txt git add hello.txt git commit -m "Add hello.txt with greeting"

💻 Interactive Terminal

Practice Git commands below. Try: init, status, add, commit, log, branch

bash — git simulator
~$help
Welcome to Git Simulator! Try: - init: Initialize repo - status: Check state - add <file>: Stage a file - commit -m "msg": Commit changes - log: View history - branch: List branches
~$

🦊 GitLab Essentials

GitLab is a complete DevOps platform. Sign up for free →

🔀 Merge Requests

Propose changes and request code review before merging branches. Discuss, review, and approve code directly in GitLab.

Docs →

🐛 Issues

Track bugs, features, and tasks. Connect issues to MRs for complete traceability from idea to deployment.

Docs →

⚙️ CI/CD Pipelines

Automate testing and deployment on every commit. Build, test, and deploy with GitLab's built-in CI/CD.

Docs →

📋 Boards

Kanban-style project management. Visualize work in progress with drag-and-drop columns.

Docs →

🔒 Protected Branches

Prevent direct pushes to main. Require reviews, tests, and approvals before merging.

Docs →

🐳 Container Registry

Store and manage Docker container images. Build and deploy containers alongside your code.

Docs →

📦 Package Registry

Host Maven, npm, NuGet, Helm, and other packages. Private package management built-in.

Docs →

🔍 Code Quality

Automatic code analysis with every pipeline. Track technical debt and code smells.

Docs →

🛡️ Security

SAST, DAST, dependency scanning, and more. Find vulnerabilities before they're deployed.

Docs →

📊 Value Streams

Track cycle time and lead time. Measure and improve your development velocity.

Docs →

🏷️ Labels & Milestones

Organize issues and MRs with labels. Track progress with milestones and due dates.

Docs →

📝 Wiki & Snippets

Document your project with built-in wiki. Share code snippets with your team.

Docs →

🚀 Your First GitLab CI/CD Pipeline

Create .gitlab-ci.yml in your repository root. This file defines your automated build, test, and deployment pipeline.

YAML
stages: - test - build - deploy test: stage: test image: node:18 script: - npm install - npm test artifacts: paths: - coverage/ when: always build: stage: build image: node:18 script: - npm run build artifacts: paths: - dist/ expire_in: 1 week deploy: stage: deploy script: - echo "Deploying to production..." only: [main] environment: name: production url: https://yourapp.com

Key CI/CD Concepts

  • stages: Define the order of jobs (test → build → deploy)
  • image: Docker image to use for the job
  • script: Commands to execute
  • artifacts: Files to pass between jobs
  • only/except: Control when jobs run (branches, tags)
  • environment: Define deployment environments

More CI/CD Examples

Check out these resources for more examples:

🔄 Common Git Workflows

Feature Branch Workflow

  1. Create a new branch: git checkout -b feature/my-feature
  2. Make changes and commit
  3. Push to GitLab: git push -u origin feature/my-feature
  4. Create a Merge Request in GitLab UI
  5. Request review from team members
  6. After approval, merge the MR

Keeping Your Fork Updated

Bash
# Add upstream remote git remote add upstream https://gitlab.com/original/repo.git # Fetch and merge git fetch upstream git checkout main git merge upstream/main git push origin main