Table of Contents
1. What is Git? " > 1. What is Git?
2. Centralized and distributed comparison" > 2. Centralized and distributed comparison
3. Git working principle " > 3. Git working principle
4. Snapshot" >4. Snapshot
5. Version " > 5. Version
6.master " > 6.master
7.HEAD " > 7.HEAD
2 Branch" >2 Branch
1. What is a branch? " > 1. What is a branch?
2. Create a branch " > 2. Create a branch
3. Branch merge" > 3. Branch merge
Three tags" >Three tags
Home Java javaTutorial What is Git? Common operations of git

What is Git? Common operations of git

Jun 30, 2017 am 10:01 AM
operate Introduction

1 Overview

1. What is Git?

Git is a distributed version control system.

2. Centralized and distributed comparison

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.

3. Git working principle

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.

4. Snapshot

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.
Copy after login

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.

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

6.master

The master branch automatically created by Git. Only this branch is visible to other users, and other branches are not visible to other users.

7.HEAD

Points to the branch and version to which the workspace file belongs.

2 Branch

1. What is a branch?

Based on the independent development context of the trunk, it does not affect the development of the trunk.

2. Create a branch

Create a new branch based on a version of an existing branch.

3. Branch merge

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.

Three tags

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

  • #reset: Go back to a certain version.

  • checkout: Convert the files in the workspace to a certain version and select a branch as the active branch.

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!

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)
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
WWE 2K25: How To Unlock Everything In MyRise
4 weeks 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)

PyCharm usage tutorial: guide you in detail to run the operation PyCharm usage tutorial: guide you in detail to run the operation Feb 26, 2024 pm 05:51 PM

PyCharm is a very popular Python integrated development environment (IDE). It provides a wealth of functions and tools to make Python development more efficient and convenient. This article will introduce you to the basic operation methods of PyCharm and provide specific code examples to help readers quickly get started and become proficient in operating the tool. 1. Download and install PyCharm First, we need to go to the PyCharm official website (https://www.jetbrains.com/pyc

Linux Deploy operation steps and precautions Linux Deploy operation steps and precautions Mar 14, 2024 pm 03:03 PM

LinuxDeploy operating steps and precautions LinuxDeploy is a powerful tool that can help users quickly deploy various Linux distributions on Android devices, allowing users to experience a complete Linux system on their mobile devices. This article will introduce the operating steps and precautions of LinuxDeploy in detail, and provide specific code examples to help readers better use this tool. Operation steps: Install LinuxDeploy: First, install

What to do if you forget to press F2 for win10 boot password What to do if you forget to press F2 for win10 boot password Feb 28, 2024 am 08:31 AM

Presumably many users have several unused computers at home, and they have completely forgotten the power-on password because they have not been used for a long time, so they would like to know what to do if they forget the password? Then let’s take a look together. What to do if you forget to press F2 for win10 boot password? 1. Press the power button of the computer, and then press F2 when turning on the computer (different computer brands have different buttons to enter the BIOS). 2. In the bios interface, find the security option (the location may be different for different brands of computers). Usually in the settings menu at the top. 3. Then find the SupervisorPassword option and click it. 4. At this time, the user can see his password, and at the same time find the Enabled next to it and switch it to Dis.

Huawei Mate60 Pro screenshot operation steps sharing Huawei Mate60 Pro screenshot operation steps sharing Mar 23, 2024 am 11:15 AM

With the popularity of smartphones, the screenshot function has become one of the essential skills for daily use of mobile phones. As one of Huawei's flagship mobile phones, Huawei Mate60Pro's screenshot function has naturally attracted much attention from users. Today, we will share the screenshot operation steps of Huawei Mate60Pro mobile phone, so that everyone can take screenshots more conveniently. First of all, Huawei Mate60Pro mobile phone provides a variety of screenshot methods, and you can choose the method that suits you according to your personal habits. The following is a detailed introduction to several commonly used interceptions:

Python ORM Performance Benchmark: Comparing Different ORM Frameworks Python ORM Performance Benchmark: Comparing Different ORM Frameworks Mar 18, 2024 am 09:10 AM

Object-relational mapping (ORM) frameworks play a vital role in python development, they simplify data access and management by building a bridge between object and relational databases. In order to evaluate the performance of different ORM frameworks, this article will benchmark against the following popular frameworks: sqlAlchemyPeeweeDjangoORMPonyORMTortoiseORM Test Method The benchmarking uses a SQLite database containing 1 million records. The test performed the following operations on the database: Insert: Insert 10,000 new records into the table Read: Read all records in the table Update: Update a single field for all records in the table Delete: Delete all records in the table Each operation

Application of Python ORM in big data projects Application of Python ORM in big data projects Mar 18, 2024 am 09:19 AM

Object-relational mapping (ORM) is a programming technology that allows developers to use object programming languages ​​to manipulate databases without writing SQL queries directly. ORM tools in python (such as SQLAlchemy, Peewee, and DjangoORM) simplify database interaction for big data projects. Advantages Code Simplicity: ORM eliminates the need to write lengthy SQL queries, which improves code simplicity and readability. Data abstraction: ORM provides an abstraction layer that isolates application code from database implementation details, improving flexibility. Performance optimization: ORMs often use caching and batch operations to optimize database queries, thereby improving performance. Portability: ORM allows developers to

PHP string manipulation: a practical way to effectively remove spaces PHP string manipulation: a practical way to effectively remove spaces Mar 24, 2024 am 11:45 AM

PHP String Operation: A Practical Method to Effectively Remove Spaces In PHP development, you often encounter situations where you need to remove spaces from a string. Removing spaces can make the string cleaner and facilitate subsequent data processing and display. This article will introduce several effective and practical methods for removing spaces, and attach specific code examples. Method 1: Use the PHP built-in function trim(). The PHP built-in function trim() can remove spaces at both ends of the string (including spaces, tabs, newlines, etc.). It is very convenient and easy to use.

How to bind WeChat on Ele.me How to bind WeChat on Ele.me Apr 01, 2024 pm 03:46 PM

Ele.me is a software that brings together a variety of different delicacies. You can choose and place an order online. The merchant will make it immediately after receiving the order. Users can bind WeChat through the software. If you want to know the specific operation method , remember to check out the PHP Chinese website. Instructions on how to bind WeChat to Ele.me: 1. First open the Ele.me software. After entering the homepage, we click [My] in the lower right corner; 2. Then in the My page, we need to click [Account] in the upper left corner; 3. Then come to the personal information page where we can bind mobile phones, WeChat, Alipay, and Taobao. Here we click [WeChat]; 4. After the final click, select the WeChat account that needs to be bound in the WeChat authorization page and click Just [Allow];

See all articles