×
Community Blog What is Git

What is Git

Git is an open source distributed version control system that can effectively and quickly handle the version management of projects from very small to very large.

In development, Git has become a mainstream code hosting technology. Basically, most companies are using Git for collaborative development. Many code hosting platforms are also implemented based on Git.

What is Git?

Git is a distributed version management tool.

  1. Distributed, so the same Git repository can be distributed to different machines.
  2. Version control tool, so it can be developed by multiple people at the same time (supports non-linear development mode); so it can retrieve the historical code (can store content, track change records)

Features of Git

  1. Git tracks and manages changes, not files.
  2. There is no "central server", each local computer is a complete version library; (usually there is also a computer that acts as a "central server", so that everyone can exchange and modify)

Track changes in text files

  1. Like all version control systems, Git can only track changes to text files (such as TXT files, web pages, program codes, etc.)
  2. Cannot track the changes of binary files (pictures, videos, etc.), only know that the file has changed, but do not know what is changed.
  3. If the project contains many non-text files, then frequently updating Git will make the actual repository size bigger and bigger.

Git can help us do many things, such as code version control, branch management, etc.

The main concepts in Git include remote warehouses, clones, local warehouses, branches, commits, pulls, merges, pushes, etc.

The remote warehouse refers to the place where our code is stored on the server. This warehouse is a place that everyone in our entire team can access.

Cloning: The process of cloning from a remote warehouse to a local

The local warehouse refers to the code stored locally after our developers clone a code from the remote warehouse. This code can only be seen by the developer of the cloned code.

Branch: We may encounter multiple branches during development, such as the master branch (master branch), development branch (develop branch), but when we develop, we generally do not develop on the master, but our own separate slave A branch (such as the test branch) is split from the main branch or the development branch, and then we develop on the test branch, and each branch has its own code.

Submit: After our code development is completed, we need to submit the code. When submitting, we need to submit the modified file and explain the modified content. Note that at this time, the code submission will only be submitted to our local warehouse, and the remote warehouse will not be modified at this time.

Pulling: During development, the same project may be developed by multiple people. At this time, we need to pull down the code modified by others and merge it into our own code. But if different developers modify the unified part of the code, then there may be conflicts. At this time, we need to resolve the conflicts before we can continue to submit the code.

Merge: After the above development of our own branch is completed, there is no problem, we need to merge our branch to the main branch

Push: All previous operations were performed locally, and the remote warehouse code has not changed. At this time, we need to push the local code to the remote warehouse and update the remote warehouse code. During the push process, if our local code is not the latest version, we need to pull down the remote code first (resolve the conflict if there is a conflict, submit it), and then push it again.

During development, we can reasonably use Git for management. When the new version encounters a problem, we may need to roll back the code and use the old version of the code, which can easily solve unexpected problems.

Related Blogs

Using Git with Jekyll on Alibaba

In this tutorial, you will install and deploy Jekyll on an Alibaba Cloud ECS instance running an NGINX server.

Version Control with GitLab on Alibaba Cloud

In this tutorial, we will be installing the open source GitLab Community Edition on an Alibaba Cloud Elastic Compute Service (ECS) instance.

0 0 0
Share on

Alibaba Cloud Community

871 posts | 198 followers

You may also like

Comments