liveBook · Manning

Git add

As explained in Road to Kubernetes

git add is a Git command that stages specified files or directories for tracking and inclusion in a commit.

git add prepares selected files or directories for inclusion in Git's next commit. It records their current saved state without yet finalizing the changes. section 2.3.3

Use git add to control which related changes enter the next commit:

Tracking a Python project

cd ~/Dev/roadtok8s/py/ git add src/main.py git add src/requirements.txt git commit -m "Initial python project commit" These commands select the files and then finalize them in a commit. section 2.3.3

Listing 2.27 Using git add to track Python files
cd ~/Dev/roadtok8s/py/
git add src/main.py
git add src/requirements.txt

Inspect a concrete listing that adds Python project files individually before committing them. section 2.3.3

How Road to Kubernetes covers it

How deep it goes
Explains path-based preparation, saved-state selection, unpreparing with git reset, and separation from committing.
Examples
Demonstrates individual Python files, a Node.js source directory, package manifests, and an initial commit.
What it assumes
Assumes a local Git repository and teaches the distinction between saving files, preparing changes, and committing them.
What you can do after
Apply it via Git to choose files or folders for a commit and revise that selection before finalizing changes.
How it connects
Connects git add with Git repositories, git commit, git reset, remote repositories, and GitHub.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Road to Kubernetes. The section links point to the parts of the book it draws on.