Git-control software zero-based practical tutorial, a set can be done

Git is an open source distributed version control system , which is currently the most advanced and popular version control system in the world. Versioning of very small to very large projects can be handled quickly and efficiently. Features: The bigger and more complex the project, the more collaborative developers, the more it can reflect the high performance and high availability of Git.

1. The difference between Git and SVN

Git is not just a version control system, it is also a content management system (CMS), work management system, etc.

If you're someone with a background in using SVN, you'll need to do a bit of a mental shift to get used to some of the concepts and features that Git provides.

The difference between Git and SVN:

  • 1. Git is distributed, SVN is not : This is the core difference between Git and other non-distributed version control systems, such as SVN, CVS, etc.

  • 2. Git stores content as metadata, while SVN stores it as files: all resource control systems hide the metadata of files in a folder like .svn, .cvs, etc.

  • 3. Git branches are different from SVN branches: branches are not special in SVN, in fact, they are just another directory in the repository.

  • 4. Git does not have a global version number, but SVN has: so far this is the biggest feature that Git lacks compared to SVN.

  • 5. Git's content integrity is better than SVN: Git's content storage uses the SHA-1 hash algorithm. This ensures the integrity of the code content and ensures less damage to the repository in the event of disk failures and network issues.

2. Git record snapshot

Git snapshot is to regenerate a new file based on the original file version, similar to backup. For efficiency, if the file has not been modified, Git does not re-store the file, but only keeps a link pointing to the previously stored file.

Disadvantages: takes up a lot of disk space

Advantages: Version switching is very fast, because each version is a complete file snapshot, and the snapshot of the target version can be directly restored when switching versions.

Features: space for time

3. Almost all operations are performed locally

Most operations in Git only require access to local files and resources, and generally do not require information from other computers on the network. Based on this feature, Git can still perform version management on the project locally after the network is disconnected. It only needs to be connected to the network to synchronize the local modified records to the cloud server.

4. Three areas in Git

A project managed by Git has three areas, namely the work area, the staging area, and the Git warehouse . If these areas are compared to the manual processing and storage management of paper documents in reality, the three areas are responsible for the following tasks:

Work area: The area responsible for processing work.

Staging area: A temporary storage area for completed work, waiting to be submitted.

Git repository: The final storage area.

5. Three states in Git

Modified: Indicates that the file has been modified, but the modified result has not been placed in the temporary storage area

Temporary storage: indicates that the current version of the modified file has been marked to be included in the list for the next submission;

Committed: Indicates that the file has been safely saved in the local Git repository.

Note: The file in the workspace has been modified, but it has not been placed in the temporary storage area, it is the modified state. A file is staged if it has been modified and put into the staging area. If a specific version of a file is stored in the Git repository, it is committed.

6. Basic Git workflow

The basic Git workflow is as follows:

① Modify the file in the workspace

② Temporarily save the changes you want to submit next time

③ Submit the update, find the file in the temporary storage area, and permanently store the snapshot in the Git warehouse.

Recommended tutorial

GIT-Zero-Basic Getting Started Practical Tutorial

book recommendation

In just a few years, Git has become the version control system that almost dominates the commercial and open source fields. This book provides a comprehensive introduction to the basics and advanced knowledge of Git version management. The book consists of 10 chapters, from the shallower to the deeper, showing how ordinary programmers and project managers can effectively use Git to improve work efficiency, master the concept of branches, flexibly use Git for servers and distributed workflows, and how to migrate development projects to Git , and how to use GitHub efficiently.

About the Author· · · · · ·

About the Author:

Scott Chacon

GitHub联合创始人,曾任GitHub首席信息官,现任在线教育创业公司Chatterbug的首席执行官。在GitHub工作的7年里,他负责维护Git主页git-scm.com,并在许多技术大会上发表过演讲,以此传播Git文化和开源精神。GitHub ID:schacon。

Ben Straub

软件开发者,曾就职于GitHub,参与开发了Libgit2开发包以及GitHub for Windows客户端,另著有《GitHub实践》。GitHub ID:ben。

Guess you like

Origin blog.csdn.net/wshyb0314/article/details/129022014