Your First Git Lab

GitGitBeginner
Practice Now

Introduction

Hi there, welcome to LabEx! In this first lab, you'll learn the classic "Hello, World!" program in Git.

Click the Continue button below to start the lab.


Skills Graph

%%%%{init: {'theme':'neutral'}}%%%% flowchart RL git(("`Git`")) -.-> git/SetupandConfigGroup(["`Setup and Config`"]) git(("`Git`")) -.-> git/BasicOperationsGroup(["`Basic Operations`"]) git/SetupandConfigGroup -.-> git/init("`Initialize Repo`") git/BasicOperationsGroup -.-> git/status("`Check Status`") subgraph Lab Skills git/init -.-> lab-92739{{"`Your First Git Lab`"}} git/status -.-> lab-92739{{"`Your First Git Lab`"}} end

Hello Git

We will use the git init command to create a new Git repository. The init command is short for "initialize".

The init command will create a new subdirectory named .git that contains all of your necessary repository files — a Git repository skeleton.

Open a new terminal and type:

cd ~/project

Let's create a new directory named lab-the-first-git-lab and initialize it as a Git repository:

mkdir lab-the-first-git-lab
cd lab-the-first-git-lab
git init

At this point, nothing in your project is tracked yet. (We'll get to that in a bit.)

Git Status

The git status command will show you the current status of your repository. It will show you which files are currently staged, unstaged, and untracked.

Let's run git status:

git status
Git status

Summary

Coungratulations! You have completed your first LabEx Lab.

If you want to learn more about LabEx and how to use it, you can visit our Support Center . Or you can watch the video to learn more about LabEx.

Programming is a long journey, but Next Lab is just one click away. Let's do it!