The difference between changes not staged and untracked files

Changes not staged means that the content of the workspace has been modified but not added to the stage. The following two operations are possible at this time:

  • It is used git add filenameto upload the modification of these work areas to the temporary storage area.
  • Use git checkout --filenameto cancel the modification of the work area. If you want to undo the modification of multiple files, you can usegit reset --hard HEAD

Untracked files are newly added files in the workspace , but they have never been added to the staging area (stage), which means that git cannot track the changes of these new files at this time.
At this operation is git add filenameto ensure that these new files can be tracked (not required if these files are not important if the tracking git these files may be added to the file which .gitignore).

Guess you like

Origin blog.csdn.net/weixin_42692164/article/details/113348542