Home >Development Tools >git >Introduction to Git&GitHub version control

Introduction to Git&GitHub version control

coldplay.xixi
coldplay.xixiforward
2021-02-22 09:38:452841browse

Introduction to Git&GitHub version control

Recommended (free): git tutorial

##Article Directory

    Version Control
    • Function of version control tools
  • Introduction to Git
    • Git Advantages
    • Git download and installation
    • Local structure of Git
    • Git and code hosting center
    • Interaction method between local card and remote library

Introduction to Git&GitHub version control

Version Control

Personal development requires continuous improvement and iteration, within the team Collaboration is required, and such needs are met by version control tools. What needs to be understood is that

version control is just an idea, and version control tools are an implementation of this idea.

(1) Centralized version control tools: CVS, SVN, VSS... Each developer is a client, and file and version information are stored on the server . The disadvantage is that it is prone to
single point of failure: Once the server goes down, all historical data will be lost.

(2) Distributed version control tools: Git, Mercurial, Bazaar, Darcs... Version control can be performed locally. Effectively avoid single points of failure.

Function of the version control tool

The version control tool has the following functions:


(1)Collaborative modification More People can modify the same file on the server side in parallel.

(2) Data backup Not only saves the current status of directories and files, but also saves the historical status of each submission.

(3) Version Management When saving the file information of each version, duplicate data should not be saved to save storage time and improve operating efficiency. In this regard, SVN adopts an
incremental management approach, while Git adopts a file system snapshot approach.
(4) Permission control Control the permissions of those who participate in development in the team;
Review the code contributed by developers outside the team(Git unique function) .
(5)History record View the modifier, modification time, modification content, and log information; restore local files to a certain historical state.

(6) Branch Management Allows the development team to advance tasks on multiple production lines at the same time during the work process, further improving efficiency.

Introduction to Git

At the beginning of Linux development, source code came from all over the world, and Linus manually summarized and merged the code. This kind of work was very complicated.

In 2002, BitMover authorized the Linux community to try the version control system BitKeeper for free for humanitarian reasons, but cracking was not allowed.

In 2005, Andrew, who developed Samba, tried to crack the BitKeeper protocol. After being discovered by BitMover, it wanted to take back the free trial rights of the Linux community; so Linus developed a distributed version control system-Git in C language. , one month later the Linux system code is managed by Git.

In 2008, GitHub went online. jQuery, Ruby, and PHP open source software all put their source codes on GitHub for hosting. Today, there are tens of thousands of good projects on GitHub.

Advantages of Git

Most operations are completed locally and do not require an Internet connection.

Integrity guaranteed. (Hash operation will be performed on each submitted data)
Add data as much as possible instead of deleting or modifying data.
Branch operations are very fast and smooth.
Fully compatible with Linux commands.

Downloading and Installation of Git

You can go to the Git official website to download the latest version of git. It is enough to use it only in GitBash.

You need to pay attention to the following pictures. For others, just install the default values ​​and download them.


Introduction to Git&GitHub version control

Introduction to Git&GitHub version control

Introduction to Git&GitHub version control

Git’s local structure

Git exists locally Three areas:

    Work area (where you write code)
  • Temporary storage area (temporary storage)
  • Local library (store historical versions)
After creating a new file in the workspace, you can use

git add to add it to the staging area, and then use git commit to add it to the local library.

Git and code hosting center

GitHub is a code hosting center for Git, and its task is to

maintain remote libraries.

    In a LAN environment, you can build a GitLab server as a code hosting center.
  • In an external network environment, GitHub and Code Cloud can be used as code hosting centers.

Interaction method between local card and remote library

Internal team collaboration:

Introduction to Git&GitHub version control
Cross-team collaboration:
Introduction to Git&GitHub version control

The above is the detailed content of Introduction to Git&GitHub version control. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:csdn.net. If there is any infringement, please contact admin@php.cn delete