Answer the question
In order to leave comments, you need to log in
What is the difference between Changes not staged for commit and Untracked files (git add command)?
I study git.
There was a question about Changes not staged for commit, Untracked files and the git add command.
(do not consider the question of aliases that allow committing with one command) The
question is simple, but here is the misunderstanding:
I created the file file1.txt
git status - Untracked files: file1.txt
git add file.txt
Changes to be committed: file1.txt
git commit. ..
All is well. Added, committed.
Next, I changed the file file1.txt
git status - Changes not staged for commit: file1.txt
That is, it must be added again git add - clearly.
Next I created a file file3.txt
git status - Untracked files: file3.txt
Total git add adds to the index and Changes not staged for commit and Untracked files.
And what's the difference then?
Both a new file and an existing one with changes cannot be committed without git add.
What is the point of dividing them into Changes not staged for commit and Untracked files?
That there are new changes in the files, that there is a new file.
Answer the question
In order to leave comments, you need to log in
Untracked files - the file has not yet been added to the repository, changes in it are not tracked, git sees only the fact that a new file with code has appeared. You can add such files to .gitignore and they will not get into the repository, unlike tracked files
Changes not staged for commit - changes in these files have not yet been added to the index for the next commit.
It's just a logical separation of entities. For git add .
no difference
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question