Check the status of files in a Git repository
Description: In a repository, create two files a.txt and b.txt, stage only a.txt, and show the status in the short format.
Hint:
- Use
git status -sfor the short format.
Solution
Terminal output
$ mkdir status-demo
$ cd status-demo
$ git init -q
$ echo "a" > a.txt
$ echo "b" > b.txt
$ git add a.txt
$ git status -s
A a.txt
?? b.txt
How it works
Ain the first column meansa.txtis staged (added).??meansb.txtis untracked.
Read Git Status.
Learn more about the similar topics:
| Tutorials |
|---|
| No Content Found. |
| Exercises & Assignments |
|---|
| No Content Found. |
| Interview Questions & Answers |
|---|
| No Content Found. |