6 | Staging Changes to Commit |
Git uses a two-step process to get changes into the repository.
The first step is staging changes through git
add
. Staging a change adds it to the
index, or staging area. This sits between the
working treeâyour view of the repositoryâand the actual
repository.
Through the staging area, you can control what is staged from the most coarse-grainedâadding everything within the repositoryâdown to editing the changes, line by line.
First you can select individual files or paths to add by calling
git add
and passing the filename or
path as the parameter. Git adds everything under a path if you
provide that. It uses standard shell-style wildcards, so wildcards
work: base.*
matches
base.rb
and base.py
.
Get Pragmatic Guide to Git now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.