What are the statuses of git files?
Git files have three states: 1. Submitted state (committed), indicating that the data has been safely saved in the local database; 2. Modified state (modified), indicating that the file has been modified but has not been saved. to the database; 3. Staged status, which means that the current version of a modified file has been marked so that it will be included in the next submitted snapshot.
The operating environment of this article: Windows 10 system, Git version 2.30.0, Dell G3 computer.
What are the statuses of git files?
There are three statuses of git files:
For the three statuses of Git files, here You need to understand the three work areas of a Git project: workspace, staging area, and Git warehouse.
Knowledge expansion:
The basic Git workflow is described as follows:
Modify something in the workspace some documents.
Take a snapshot of the modified file and then add it to the staging area.
Commit the update and permanently dump the file snapshot saved in the staging area to the Git repository.
GIt has three states before submission: Untracked files (not tracked and monitored), Changes not staged for commit, and Changes to be committed. These three states can be converted at will.
Untracked files: The marked files have not been monitored and managed by git. At this time, you can use the git add command to add files that are prompted as Untracked files to the git warehouse.
Changes to be committed: Files in this status have been snapshotted in the temporary storage area and are waiting to be committed. At this time, you can use git commit -m "comment" to submit the file.
At this time, you can also use the git rm --cached file name command to restore the file status to the Untracked status.
Files in the Changes to be committed state can be submitted or continue to be modified.
Changes not staged for commit: After the file in the Changes to be committed state is not committed and continues to be modified, check through git status and you will have the Changes not staged for commit state. This status indicates that the file has been modified, but has not been placed in the staging area and a snapshot has not been generated. Two operations can be performed at this time, commit and add operations.
If a commit operation is performed, only the files before modification will be submitted to the git version directory (only files in the temporary storage area and files with a status of Changes to be committed can be submitted); if necessary, the modification will be If the subsequent files are also submitted, you need to use the git add command to add the files to the staging area. If you want to undo changes, use: git checkout --filename.
Recommended study: "Git Tutorial"
The above is the detailed content of What are the statuses of git files?. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



Running the H5 project requires the following steps: installing necessary tools such as web server, Node.js, development tools, etc. Build a development environment, create project folders, initialize projects, and write code. Start the development server and run the command using the command line. Preview the project in your browser and enter the development server URL. Publish projects, optimize code, deploy projects, and set up web server configuration.

Under the BeegoORM framework, how to specify the database associated with the model? Many Beego projects require multiple databases to be operated simultaneously. When using Beego...

GiteePages static website deployment failed: 404 error troubleshooting and resolution when using Gitee...

Which libraries in Go are developed by large companies or well-known open source projects? When programming in Go, developers often encounter some common needs, ...

The problem of using RedisStream to implement message queues in Go language is using Go language and Redis...

The H5 page needs to be maintained continuously, because of factors such as code vulnerabilities, browser compatibility, performance optimization, security updates and user experience improvements. Effective maintenance methods include establishing a complete testing system, using version control tools, regularly monitoring page performance, collecting user feedback and formulating maintenance plans.

There are two ways to convert XML to Excel: use built-in Excel features or third-party tools. Third-party tools include XML to Excel converter, XML2Excel, and XML Candy.

Resource management in Go programming: Mysql and Redis connect and release in learning how to correctly manage resources, especially with databases and caches...
