In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
One of the differences between Git and other version control systems such as SVN is the concept of a temporary storage area.
Let's first look at the noun explanation.
Work area (Working Directory)
This is the directory you can see on your computer. For example, my learngit folder is a workspace:
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 are the temporary storage area called stage (or index), the first branch master that Git automatically created for us, and a pointer to master called HEAD.
We'll talk about the concepts of branching and HEAD later.
As mentioned earlier, when we add files to the Git version library, it is performed in two steps:
The first step is to add the file with git add, which is actually adding file changes to the temporary storage area.
The second step is to commit the changes using git commit, which essentially commits all the contents of the staging area to the current branch.
Because Git automatically created the only master branch for us when we created the Git version library, git commit is now committing changes to the master branch.
You can simply understand that all the file changes that need to be submitted are put in the temporary storage area, and then all the changes in the temporary storage area are submitted at once.
As the saying goes, true knowledge comes from practice. Now, let's practice it again by making a change to readme.txt, such as adding a line:
Git is a distributed version control system.Git is free software distributed under the GPL.Git has a mutable index called stage.
Then, add a LICENSE text file (whatever you want) to the workspace.
First use git status to check the status:
$git status# On branch master# Changes not staged for commit:# (use "git add..." To update what will be committed) # (use "git checkout--..." To discard changes in working directory) # # modified: readme.txt## Untracked files:# (use "git add..." To include in what will be committed) # # LICENSEno changes added to commit (use "git add" and/or "git commit-a")
Git tells us very clearly that readme.txt has been modified and LICENSE has never been added, so its state is Untracked.
Now, after using the command git add twice and adding both readme.txt and LICENSE, use git status to check again:
$git status# On branch master# Changes to be committed:# (use "git reset HEAD..." To unstage) # # new file: LICENSE# modified: readme.txt#
Now, the state of the staging area is like this:
So, the git add command is actually putting all the changes to be committed into the Stage, and then executing git commit can commit all the changes to the staging area to the branch at once.
$git commit-m "understand how stage works" [master 27c9860] understand how stage works 2 files changed, 675 insertions (+) create mode 100644 LICENSE
Once submitted, if you haven't made any changes to the workspace, the workspace is "clean":
$git status# On branch masternothing to commit (working directory clean)
Now that the version library is like this, there is nothing in the staging area:
Summary
Staging area is a very important concept of Git. If you understand the temporary storage area, you will understand what many operations of Git do.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 227
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.