Learn Git and GitLab Tutorial For Beginners | Full Course |Video upload date:  · Duration: PT1H44M9S  · Language: EN

Beginner friendly guide to Git and GitLab covering setup branching merging CI CD and workflow best practices for 2024

Step by step Git workflow and GitLab CI tips for beginners and teams

This crash friendly guide covers Git basics and GitLab workflows with real world tips and a mild sarcastic undertone. You will learn local setup commits branching pushing merge requests and a gentle look at GitLab CI pipelines for automated tests and deploys. Think of this as a survival guide for version control so your future self does not rage at you.

Install and configure Git

Install Git from your package manager or from the official site. Then set your identity so commits are traceable and you do not end up as anonymous mystery contributor.

git config --global user.name 'Your Name'
git config --global user.email 'you@example.com'
ssh-keygen -t rsa -b 4096 -C 'you@example.com'

Copy the public key from ~/.ssh/id_rsa.pub and paste it into your GitLab profile under SSH Keys for secure password free pushes. Use git config to make settings permanent and avoid awkward anonymous commits later.

Local workflow and commits

Stage deliberately and commit often. Use git add to pick changes and git commit to create a checkpoint. Small logical commits make reviews less painful and debugging less like archaeology.

  • git status to see your state
  • git add <path> or git add . to stage
  • git commit -m 'clear message' to record a change

Good commit messages save team sanity. Include the why not just the what so your reviewers do not have to guess your motives.

Branching and merging

Create branches for features and fixes so main stays calm and deployable. Use git checkout -b feature/name or the modern git switch -c feature/name when you want a cleaner vibe.

When it is time to integrate choose merge to preserve history or rebase to tidy up a slim sequence of commits. Merge keeps the story intact and rebase rewrites history into something neat. Pick what fits your team workflow.

Remote repositories and GitLab

Use git push and git pull to sync with remotes. If your workflow uses forks create merge requests to ask for reviews and to trigger CI pipelines on GitLab. Merge requests are the polite method to get feedback and to run tests before code reaches main.

GitLab CI and pipelines

GitLab CI is driven by a file named .gitlab-ci.yml which defines jobs that run on runners. Jobs can run tests builds and deploy steps and give feedback before code lands in production. You do not need to be a YAML wizard to get useful pipelines running.

Common pipeline stages

  • Run unit tests to catch regressions
  • Build artifacts so you can deploy the same thing everywhere
  • Deploy to staging to validate in a safe area
  • Run smoke checks so basic functionality is verified

Collaboration and best practices

Protect main branches and require merge requests and approvals. Use descriptive branch names like feature/login or fix/logout-bug and keep changes small so reviewers do not fall asleep.

Use CI checks and code review rules to catch problems early. Write commit messages that explain the why and avoid gigantic diffs that make reviewers weep quietly.

Quick cheat sheet

Keep these five commands in a dotfile or your repo README to save time and dignity.

  • git status
  • git add .
  • git commit -m 'small clear message'
  • git push
  • git pull

Follow these steps and you will gain practical skills in version control and continuous delivery without summoning mystical rituals. Now go make a branch and try not to break the build.

I know how you can get Azure Certified, Google Cloud Certified and AWS Certified. It's a cool certification exam simulator site called certificationexams.pro. Check it out, and tell them Cameron sent ya!

This is a dedicated watch page for a single video.