Menu

Log in

Sign up

From beginner to master of web design, coding, infrastructure operation, business development and marketing

  • COURSES
  • HTML & CSS Introduction
  • HTML & CSS Coding with AI
  • Linux Introduction
  • Docker Basics
  • Git & GitHub Introduction
  • JavaScript Coding with AI
  • Django Introduction
  • AWS Basics
  • Figma Introduction
  • SEO Tutorial for Beginners
  • SEO with AI
  • OTHERS
  • About
  • Terms of Service
  • Privacy Policy

© 2024 D-Libro. All Rights Reserved

Git & GitHub IntroductionChapter 4. Edit & Commit

Check Status of Working Tree and Staging Area – git status

Check Status of Working Tree and Staging Area – git status

Using git status to Check Your Working Tree

git status is the command that can be used to see the status of the Working Tree and the INDEX. This status lets you see which changes have been staged, which haven't, and which files aren't tracked by Git.

There are two types of information that the git status command provides: branch status and commit status. On this page, we'll mainly cover the second one (commit status).

Information provided by the git status command

1. Branch status: on which branch you are currently working (the branch concept will be explained in the next chapter)

2. Commit status mainly covers the following status

  1. Existence of untracked files
  2. Existence of not staged files
  3. Files in INDEX (Staging Area) but not committed yet
  4. All files are tracked and committed

Here are detailed explanations with examples of typical git status responses.

1. Existence of untracked files

When you haven't run a commit before and haven't staged any files, the files can have the statuses shown in the illustration below.

git status visual explanations: Case 1

When you run the git status command, you'll see a message like below.

git status response
On branch master
No commits yet
Untracked files:
  (use "git add <file>..." to include in what will be committed)
        file_a
        file_b
        file_c
        file_d

2. Existence of not staged files

In typical git operations, you'll add the files to INDEX...

git status visual explanations: Case 2

...and commit the files.

git status visual explanations: Case 3

After everything is committed, you may edit some files like in the illustration below. The files are already tracked in the operations above but changes are not staged yet.

git status visual explanations: Case 4

When you run the git status command under this situation (before you add the changes to INDEX), you'll see a message like below.

git status response
On branch master
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:   file_a
        modified:   file_b

3. Files in the INDEX (Staging Area) but not committed yet

If you staged the modified files by the git add command but have not committed them yet, the files can have the statuses shown in the illustration below.

git status visual explanations: Case 5

When you run the git status command in this situation (before you commit the changes), you'll see a message like below.

git status response
On branch master
Changes to be committed:
  (use "git restore --staged <file>..." to unstage)
        modified:   file_a
        modified:   file_b

4. All files are tracked and committed

After you commit all the changes like in the illustration below...

git status visual explanations: Case 6

..., you'll see a message like below.

On branch master
nothing to commit, working tree clean

You can also learn this topic offline. Click AmazonKindle.

More Topics to Explore

Customizing Django Views to Change List Order

Customize Views (1) – Change List Order

Writing Class-Based Views Using Django Generic Views

How To Write Class-Based Views with Generic Views

Git Branch Operation Lifecycle Steps

Branch Operation Basic Life Cycle

Performing Database Migrations in Django

Database Migration

How to Upload Changes with git push

Upload to Remote Repository – Git Push

Customizing Django Views to Change List Order

Customize Views (1) – Change List Order

Writing Class-Based Views Using Django Generic Views

How To Write Class-Based Views with Generic Views

Git Branch Operation Lifecycle Steps

Branch Operation Basic Life Cycle

Performing Database Migrations in Django

Database Migration

How to Upload Changes with git push

Upload to Remote Repository – Git Push

Tags:

Git Key Commands

Git & GitHub Introduction
Course Content

Chapter 1. Git & GitHub Overview

What Is Git?

What Is Version Control?

How To Save Versions in Git?

Collaborating on Git & GitHub – Remote Repository

Collaborating on Git & Git Hub – Branch

Git & GitHub Basic Life Cycle

Chapter 2. Git & GitHub Initial Settings

Git & GitHub Initial Settings Overview

Key Tool Preparation (1) – Mac

Key Tool Preparation (2) – Windows

Key Tool Preparation (3) – Linux Remote Server

Git User Settings – git config

Create GitHub Account

GitHub Access Authentication Settings

Generating PAT (Personal Access Token)

GitHub SSH Setup

Chapter 3. Git & GitHub Project Setup

Three Cases in Git & GitHub Project Setup

Git & GitHub Project Setup Overview in Different Cases

Building Remote Collaboration Practice Environment

Project Initiator – Key Steps To Launch Git Project

Project Initiator – Create Local Repository (git init)

Project Initiator – Make the First Commit

Project Initiator – .gitignore File

Project Initiator – Create Remote Repository

Project Initiator – Link Between Remote and Local Repositories (git remote add)

Project Initiator – Upload Local Repository to Remote Repository (git push)

Project Initiator – Grant Remote Repository Access to Project Members

Project Member – Start Project As Collaborator

Project Member – Create Copy of Project Code on Local Computer (git clone)

Non-Member – Start Project With Replica of Existing Repository (Fork)

Fork vs. Clone

Chapter 4. Edit & Commit

Git Regular Workflow – Edit & Commit

Edit and Commit Overview (1)

Add Files to Staging Area – git add

Commit Files – git commit

HEAD and INDEX

Check Status of Working Tree and Staging Area – git status

Check Commit Histories – git log

Check Differences – git diff

Restore Files to Working Tree – git restore

Undo Changes – git reset

Delete Files – git rm

Edit and Commit Overview (2)

Chapter 5. Work With Branches

Git Regular Workflow – Work With Branches

What Is Branch?

Branch Operation Basic Life Cycle

Create Branch and Check Branch Status – Git Branch

Switch Current Branch (1) – Git Checkout

Switch Current Branch (2) – Git Switch

Merge Branches – Git Merge

Fast-Forward Merge

Non-Fast-Forward Merge (No Option)

Non-Fast-Forward Merge (--no-ff Option)

Squash Merge

Rebase Branch – Git Rebase

Managing Conflict

Stash Changes – Git Stash

Chapter 6. Remote Collaboration

Git Regular Workflow – Remote Collaboration

Remote Collaboration Overview

Link With Remote Repository – Git Remote

Upload to Remote Repository – Git Push

Download Remote Repository and Merge to Local Repository – Git Pull

Get Remote Repository Information to Local Repository – Git Fetch

Pull vs. Fetch

Request for Review and Merge – Pull Request

Merge Operation Using GitHub

Chapter 7. Supplemental Topics

Git Key Commands and GitHub Key Features

Git & GitHub Glossary

GitHub Other Features

Chapter 1. Git & GitHub Overview

What Is Git?

What Is Version Control?

How To Save Versions in Git?

Collaborating on Git & GitHub – Remote Repository

Collaborating on Git & Git Hub – Branch

Git & GitHub Basic Life Cycle

Chapter 2. Git & GitHub Initial Settings

Git & GitHub Initial Settings Overview

Key Tool Preparation (1) – Mac

Key Tool Preparation (2) – Windows

Key Tool Preparation (3) – Linux Remote Server

Git User Settings – git config

Create GitHub Account

GitHub Access Authentication Settings

Generating PAT (Personal Access Token)

GitHub SSH Setup

Chapter 3. Git & GitHub Project Setup

Three Cases in Git & GitHub Project Setup

Git & GitHub Project Setup Overview in Different Cases

Building Remote Collaboration Practice Environment

Project Initiator – Key Steps To Launch Git Project

Project Initiator – Create Local Repository (git init)

Project Initiator – Make the First Commit

Project Initiator – .gitignore File

Project Initiator – Create Remote Repository

Project Initiator – Link Between Remote and Local Repositories (git remote add)

Project Initiator – Upload Local Repository to Remote Repository (git push)

Project Initiator – Grant Remote Repository Access to Project Members

Project Member – Start Project As Collaborator

Project Member – Create Copy of Project Code on Local Computer (git clone)

Non-Member – Start Project With Replica of Existing Repository (Fork)

Fork vs. Clone

Chapter 4. Edit & Commit

Git Regular Workflow – Edit & Commit

Edit and Commit Overview (1)

Add Files to Staging Area – git add

Commit Files – git commit

HEAD and INDEX

Check Status of Working Tree and Staging Area – git status

Check Commit Histories – git log

Check Differences – git diff

Restore Files to Working Tree – git restore

Undo Changes – git reset

Delete Files – git rm

Edit and Commit Overview (2)

Chapter 5. Work With Branches

Git Regular Workflow – Work With Branches

What Is Branch?

Branch Operation Basic Life Cycle

Create Branch and Check Branch Status – Git Branch

Switch Current Branch (1) – Git Checkout

Switch Current Branch (2) – Git Switch

Merge Branches – Git Merge

Fast-Forward Merge

Non-Fast-Forward Merge (No Option)

Non-Fast-Forward Merge (--no-ff Option)

Squash Merge

Rebase Branch – Git Rebase

Managing Conflict

Stash Changes – Git Stash

Chapter 6. Remote Collaboration

Git Regular Workflow – Remote Collaboration

Remote Collaboration Overview

Link With Remote Repository – Git Remote

Upload to Remote Repository – Git Push

Download Remote Repository and Merge to Local Repository – Git Pull

Get Remote Repository Information to Local Repository – Git Fetch

Pull vs. Fetch

Request for Review and Merge – Pull Request

Merge Operation Using GitHub

Chapter 7. Supplemental Topics

Git Key Commands and GitHub Key Features

Git & GitHub Glossary

GitHub Other Features