Untracked, staged, unchanged và unstaged là 4 trạng thái chính của một file
Git essentially has 4 main statuses for the files in your local repo:
- untracked: The file is new, Git knows nothing about it. If you
git add <file>
, it becomes: - staged: Now Git knows the file (tracked), but also made it part of the next commit batch (called the index). If you
git commit
, it becomes: - unchanged: The file has not changed since its last commit. If you modify it, it becomes:
- unstaged: Modified but not part of the next commit yet. You can stage it again with
git add
As you can see, a git add
will track untracked files, and stage any file.
Also: You can untrack an uncommited file with git rm --cached filename
and unstage a staged file with git reset HEAD <file>
Nguồn:: Stack Overflow, Concept of git tracking and git staging