git status
- Git course
- Beginner
- Lesson 25/80
- 4 min
Learn to view the repository state with git status.
Use the git status Command
git status displays the current state of files in a Git repository. You can use it to see whether the working tree has changes and which files have been staged.
git statusWorking Tree and Staged Changes
Git status output shows unstaged changes and staged changes separately. This lets you check which files are ready to be committed.
git add index.html
git statusPractice Store the Status Command in a Variable
Assign the git status command as a string to a variable named statusCommand. Then print the variable's value.
Starter code
// Durum komutunu tanımla
let statusCommand;
// Komutu yazdırSample solution
let statusCommand = 'git status';
console.log(statusCommand);Expected output
git status
Questions and answers
Review the lesson questions together with their answers. To test yourself, solve the lesson interactively.
1 Which command displays the state of files in a repository?
- git status Correct answer
- git commit
- git config
- git add
Explanation: <code>git status</code> displays the state of the working tree and staging area.
2 Complete the Status Command
Depodaki dosyaların mevcut durumunu görmek için ____ komutunu çalıştırırsın.
Depodaki dosyaların mevcut durumunu görmek için git status komutunu çalıştırırsın.
Explanation: <code>git status</code> displays the working tree and staging area state of files.
3 Match the Status Output Concepts
| Term | Meaning |
|---|---|
working_tree |
Files being worked on |
staged |
Changes prepared for commit |
git_status |
Display repository status |
repository |
Git record area of a project |