Table of Contents
What are the statuses of git files?
Home Development Tools git What are the statuses of git files?

What are the statuses of git files?

Jun 30, 2022 pm 05:47 PM
git

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.

What are the statuses of git files?

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:

What are the 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.

What are the statuses of git files?

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!

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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
WWE 2K25: How To Unlock Everything In MyRise
1 months ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to run the h5 project How to run the h5 project Apr 06, 2025 pm 12:21 PM

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.

How to specify the database associated with the model in Beego ORM? How to specify the database associated with the model in Beego ORM? Apr 02, 2025 pm 03:54 PM

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...

Gitee Pages static website deployment failed: How to troubleshoot and resolve single file 404 errors? Gitee Pages static website deployment failed: How to troubleshoot and resolve single file 404 errors? Apr 04, 2025 pm 11:54 PM

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

Which libraries in Go are developed by large companies or provided by well-known open source projects? Which libraries in Go are developed by large companies or provided by well-known open source projects? Apr 02, 2025 pm 04:12 PM

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, ...

How to solve the user_id type conversion problem when using Redis Stream to implement message queues in Go language? How to solve the user_id type conversion problem when using Redis Stream to implement message queues in Go language? Apr 02, 2025 pm 04:54 PM

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

Does H5 page production require continuous maintenance? Does H5 page production require continuous maintenance? Apr 05, 2025 pm 11:27 PM

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.

How to convert xml to excel How to convert xml to excel Apr 03, 2025 am 08:54 AM

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.

In Go programming, how to correctly manage the connection and release resources between Mysql and Redis? In Go programming, how to correctly manage the connection and release resources between Mysql and Redis? Apr 02, 2025 pm 05:03 PM

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

See all articles