WorkSpace
Conclusion
Working Directory
It refers to the directory you can see on your computer and the directory you created when creating the version library.Repository
The workspace has a hidden directory .git
, which is not a workspace, but a version library of Git
.
There are many things in Git's version library, the most important of which is the staging area called stage
(or index
).
Caption
As mentioned earlier, when we add files to the Git version library, it is implemented in two steps:
The first step is to add files with 'git add', which is actually to add file modifications to the staging area;
The second step is to use 'git commit' to submit changes. In fact, it is to submit all the contents of the staging area to the current branch.
Because when we create the Git version library, Git automatically creates the only master
branch for us, so now, git commit
is to submit changes to the master
branch.
You can simply understand that the file changes that need to be submitted are always placed in the staging area, and then all changes in the staging area are submitted at once.