Getting Started with GitHub: A Beginner's Guide to Version Control and Collaboration

Checking the Status of Your Repository

Section 6

Your First Steps with Git: Installation and Basics

Getting Started with GitHub: A Beginner's Guide to Version Control and CollaborationYour First Steps with Git: Installation and Basics

Once you've initialized a Git repository, or after you've made some changes within an existing one, the most fundamental command you'll use is git status. Think of it as your repository's doctor, always ready to give you a health check. It tells you what Git knows about your project's current state – which files have been modified, which are new and untracked, and which are ready to be committed.

To see the status of your repository, simply navigate to your project's root directory in your terminal and type:

git status

The output of git status is incredibly informative. Let's break down some common scenarios you might encounter.

Scenario 1: A clean repository. If you've committed all your changes, or if you haven't made any yet, git status will tell you that.

On branch main
nothing to commit, working tree clean

Scenario 2: Modified files. If you've edited files that Git is already tracking, they will appear under the 'Changes not staged for commit' section.

On branch main
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)

	modified:   README.md

no changes added to commit (use "git add" and/or "git commit -a")
チャプターへ戻る