Git Add
Part of the Version Control section of Coddy's Terminal journey. Lesson 10 of 58.
The git add command moves changes into the staging area. You name the file (or files) you want to stage:
git add hello.txtYou can stage several files at once, or use a wildcard:
git add file1.txt file2.txt
git add *.mdOr stage every change in the current folder with a single dot:
git add .After staging, git status --short shows the file with a different prefix. Untracked files used the ?? code; staged new files use A (for added).
A hello.txtThe file is now ready to be included in the next commit.
Challenge
BeginnerThe folder contains a file called welcome.txt. Initialize the repository, stage welcome.txt, then run git status --short.
The expected output is the staged-add line.
Try it yourself
This lesson includes a short quiz. Start the lesson to answer it and track your progress.
All lessons in Version Control
2Getting Started
Initialize A RepositoryThe .git FolderConfigure Your IdentityGit StatusRecap - First Repo8Merging
What Is A MergeFast-Forward MergeThree-Way MergeMerge ConflictsResolve A ConflictRecap - Merge Master11Feature Branch Project
Project OverviewInitialize Main3Tracking Changes
The Staging AreaGit AddGit CommitModifying A Tracked FileGit LogRecap - First Commits6Recipe Site Project
Project OverviewInitialize And IgnorePractice on your own: Terminal playground