DevOps Bootcamp · Lesson

Staging, Committing, History

Understand the staging area, how to commit changes, and explore your project's commit history using `git log`.

Lesson 1 of 412 steps

Staging, Committing, History is a free DevOps Bootcamp lesson on CoddyKit. This is lesson 1 of 4. Any 3 lessons of this learning path are free to read in full — after that, CoddyKit PRO unlocks every lesson, plus hands-on practice with a built-in code editor and a 24/7 AI tutor. It is part of the DevOps Bootcamp learning path, and your progress syncs across the web and the CoddyKit app. The DevOps Bootcamp course includes 4 lessons in total.

The Git Staging Area

In Git, the staging area (also called the index) is a crucial intermediate step between your working directory and your repository.

Think of it as a waiting room where you prepare changes before permanently saving them.

It allows you to group related changes into a single, meaningful commit.

Adding Files to Staging

To move changes from your working directory into the staging area, you use the git add command.

You specify the file(s) you want to stage. This tells Git, "Hey, I want to include these changes in my next commit!"

git add myfile.txt

Staging Multiple Changes

You don't have to add files one by one. Git provides convenient ways to stage multiple files or even all changes at once.

  • git add . stages all new and modified files in the current directory and its subdirectories.
  • git add -u stages only modified and deleted files (not new ones).
git add .

What is a Commit?

A commit is like taking a snapshot of your project at a specific point in time. It permanently records the staged changes into your Git repository.

Each commit has a unique ID, an author, a timestamp, and a commit message explaining what changes were made.

Making Your First Commit

Once your changes are in the staging area, you can commit them using git commit. You should always include a clear and concise message to describe the changes.

The -m flag lets you provide the commit message directly.

git commit -m "Add initial project files"

Checking Your Project Status

The git status command is your best friend! It tells you:

  • Which files are untracked (new and not yet added to Git).
  • Which files have changes that are ready to be committed (staged).
  • Which files have changes that are not yet staged.
git status

Reviewing Unstaged Changes

Before staging or committing, it's good practice to review your changes. The git diff command helps you see exactly what's changed in your files.

By default, git diff shows changes in your working directory that are *not* yet staged.

git diff

Reviewing Staged Changes

What if you want to see the changes you've already moved to the staging area, before committing them?

You can use git diff --staged (or git diff --cached) to compare the staged changes with the last commit.

git diff --staged

Viewing Commit History

To see a chronological list of all commits in your repository, use the git log command. This shows you who made changes, when, and what their commit messages were.

It's essential for understanding your project's evolution!

git log

Simplifying the Log Output

The default git log output can be quite detailed. For a quick overview, you can use options to simplify it:

  • git log --oneline: Shows each commit on a single line.
  • git log --graph: Displays an ASCII art tree of the commit history.
git log --oneline

Staging & Committing Quiz

You've just modified index.html and created a new file style.css. You want to include both in your next commit.

Which sequence of commands correctly stages and commits these changes?

Recap: Staging, Committing, History

Great job! In this lesson, you learned the core steps of Git's local workflow:

  • The staging area (index) is where you prepare changes.
  • Use git add to move changes to the staging area.
  • A commit is a permanent snapshot of your staged changes.
  • Use git commit -m "message" to save a commit.
  • git status shows your working directory's state.
  • git diff helps review changes.
  • git log allows you to explore your project's history.

These commands are fundamental to tracking your project's progress!

Free to start

Learn DevOps Bootcamp with an AI tutor — free

Write and run real code in your browser, get instant help from a 24/7 AI tutor, and pick up where you left off on the web or in the app.

Courses
142
Lessons
568

Frequently Asked Questions

Is the “Staging, Committing, History” lesson free?

Yes — any 3 lessons of the DevOps Bootcamp learning path, including “Staging, Committing, History”, are free to read in full here on the web. After that, CoddyKit PRO unlocks every lesson, plus interactive practice with a built-in code editor and a 24/7 AI tutor. The DevOps Bootcamp course includes 4 lessons in total.

What will I learn in “Staging, Committing, History”?

Understand the staging area, how to commit changes, and explore your project's commit history using `git log`. You practise DevOps Bootcamp with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.

Do I need any experience to start DevOps Bootcamp?

No prior experience is required. DevOps Bootcamp on CoddyKit is structured for beginners through advanced learners, so you can start here or from the beginning and move at your own pace. This is lesson 1 of 4.

How long does the “Staging, Committing, History” lesson take?

Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.

Can I write and run code in this DevOps Bootcamp lesson?

Yes. Every DevOps Bootcamp lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.

All lessons in this course

  1. Staging, Committing, History
  2. Undoing Changes Locally
  3. Branching & Merging Basics
  4. Stashing Work in Progress
← Back to DevOps Bootcamp