Home > Development Tools > git > What does staged mean in git?

What does staged mean in git?

WBOY
Release: 2022-01-07 15:53:42
Original
6243 people have browsed it

In git, staged is used to indicate the status of a file, which means temporary storage status. Changes to files or directories in this status will not affect the status of the warehouse. They are also invisible when committing. When it arrives, execute "git commit" to synchronize the changes to the library. At this time, the files in the library and the local files become consistent again.

What does staged mean in git?

The operating environment of this article: Windows 10 system, Git version 2.30.0, Dell G3 computer.

What does staged mean in git

There are roughly 4 states of files in the folder where the git library is located

  • Untracked: This file is in the folder, but has not been added to the git library and does not participate in version control. The status changes to Staged through git add.

  • Unmodify: The file has been stored in the library and has not been modified, that is, the file snapshot content in the repository is exactly the same as that in the folder. This type of file has two places. If it is modified, it becomes Modified. If you use git When rm is moved out of the repository, it becomes an Untracked file

  • Modified: The file has been modified, just modified, and no other operations have been performed. This file also has two places, which can be accessed through git add The staged state is temporarily saved. Use git checkout to discard the modifications and return to the unmodify state. This git checkout takes the file from the library and overwrites the current modifications

  • Staged: Staging state. Execute git commit synchronizes the modifications to the library. At this time, the files in the library and the local files become consistent again, and the files are in the Unmodify state. Execute git reset HEAD filename to cancel the temporary save, and the file status is Modified

What does staged mean in git?

Change from untracked state to staged state

We can directly change a file that is not included in version management to staged state through git add

What does staged mean in git?

Change from modified state to staged state

When your file is modified, you can still change the modified file to staged state through git add

What does staged mean in git?

Include all files in the current directory into the staged state

If there are newly created files (in the untracked state) under the current working tree, and there are files that have been modified (in the modified state) status), at this time we can change all files to staged status through git add -A

What does staged mean in git?

Recommended learning: "Git Tutorial"

The above is the detailed content of What does staged mean in git?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
git
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template