Home >Java >javaTutorial >What is Git? Common operations of git
1 Overview
Git is a distributed version control system.
In a centralized version control system, the version library is concentrated on the central server. When working, you need to obtain the latest version from the central server first. After modification, is then pushed to the central server. Not only is it limited by network transmission, but also once the central server fails, the entire version library may be lost. The distributed version control system has no central server. Each working computer has a complete version library. Task operations are based on local files. After the file is modified, only Just push it to other collaborators, which not only gets rid of the limitation of network speed, but also the version library is distributed on multiple computers, making it safer.
Git local operations are divided into three areas:
Workspace: All directories visible in the local warehouse belong to the workspace.
# Staging area: In the index file in the ".git" folder.
# Repository: In the ".git" folder.
First execute the "git add" command to put the operation into the staging area (Stage), and then execute "git commit" to submit the files in the staging area to Repository.
The concept of snapshot comes from the field of photography. It is a way to quickly record information. The carrier is small in size and almost contains For all the information you are interested in, the original Git English text introduces it as follows:
Every time you commit, or save the state of your project in Git, it basically takes a picture of what all your files look like at that moment and stores a reference to that snapshot.
Snapshots can be understood as a simple way to record the current state of an object. Although this method is simple, it contains all the information of the object.
Git records not the differences between versions, but a snapshot of each version.
The version is project-wide and represents the status of the entire project. After one of the files is modified and submitted, the version is updated. The versions of other unmodified files are also updated.
The master branch automatically created by Git. Only this branch is visible to other users, and other branches are not visible to other users.
Points to the branch and version to which the workspace file belongs.
Based on the independent development context of the trunk, it does not affect the development of the trunk.
Create a new branch based on a version of an existing branch.
If starting from a common starting point, only one branch A of the two branches has modified the file, then The pointer of the other branch can point to the current version of branch A, and the merged file is the current version of A. If starting from a common starting point, both branches have modified files, there will be conflicts when merging , manually trim them, then add the files to the buffer Add to Index, and then commit.
When one branch merges with another branch, a new version will be generated.
The tag has the same function as the commit id. They are used to mark the version. The commit id uses 40 characters and is difficult to remember. , therefore a simplified way of marking versions, namely tags, has been developed to customize an easy-to-remember name for versions that require special attention to facilitate subsequent inquiries.
Four Common Operations
This is what I learned and summarized for the first time. It focuses on simple operations under Eclipse. There are too few theoretical things. The following link explains it in more detail. , you can study in depth:
The above is the detailed content of What is Git? Common operations of git. For more information, please follow other related articles on the PHP Chinese website!