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:
- Add one file with git add <path>. section 2.3.3
- Add a directory with git add <path> or git add src. section 2.3.6
- Undo preparation for a path with git reset <path>. section 2.3.3
- Finish the process separately with git commit -m "Commit message". section 2.3.3
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
