left-icon

Git Succinctly®
by Ryan Hodson

Previous
Chapter

of
A
A
A

CHAPTER 1

Overview

Overview


Each Git repository contains 4 components:

  • The working directory
  • The staging area
  • Committed history
  • Development branches

Everything from recording commits to distributed collaboration revolves around these core objects.

The Working Directory

The working directory is where you actually edit files, compile code, and otherwise develop your project. For all intents and purposes, you can treat the working directory as a normal folder. Except, you now have access to all sorts of commands that can record, alter, and transfer the contents of that folder.

The working directory

Figure 2: The working directory

The Staging Area

The staging area is an intermediary between the working directory and the project history. Instead of forcing you to commit all of your changes at once, Git lets you group them into related changesets. Staged changes are not yet part of the project history.

The working directory and the staging area

Figure 3: The working directory and the staging area

Committed History

Once you’ve configured your changes in the staging area, you can commit it to the project history where it will remain as a “safe” revision. Commits are “safe” in the sense that Git will never change them on its own, although it is possible for you to manually rewrite project history.

The working directory, staged snapshot, and committed history

Figure 4: The working directory, staged snapshot, and committed history

Development Branches

So far, we’re still only able to create a linear project history, adding one commit on top of another. Branches make it possible to develop multiple unrelated features in parallel by forking the project history.

The complete Git workflow with a branched history

Figure 5: The complete Git workflow with a branched history

Git branches are not like the branches of centralized version control systems. They are cheap to make, simple to merge, and easy to share, so Git-based developers use branches for everything—from long-running features with several contributors to 5-minute fixes. Many developers only work in dedicated topic branches, leaving the main history branch for public releases.

Scroll To Top
Disclaimer
DISCLAIMER: Web reader is currently in beta. Please report any issues through our support system. PDF and Kindle format files are also available for download.

Previous

Next



You are one step away from downloading ebooks from the Succinctly® series premier collection!
A confirmation has been sent to your email address. Please check and confirm your email subscription to complete the download.