Teacher Zhang's class-Git summary

Preface


Last weekend, Xiao Zhang told me about the application of Git in the project. The master led the door. The practice is personal, and you need to do it yourself to master this tool. So in the first step, I skimmed the series of blogs by Brother Xiao Zhang to build a solid foundation and practice.

What is Git?


Git is an open source distributed version control system for agile and efficient processing of any small or large project.
Git is an open source version control software developed by Linus Torvalds to help manage the development of the Linux kernel.
Git is different from the commonly used version control tools CVS, Subversion, etc., it uses a distributed version library, without server-side software support.

The summary is: git is the most advanced, git is the most powerful, and git is high-end and elegant! ~

The core difference between Git and SVN-distributed management


1. Centralized version management system

Write picture description here

This picture can reflect the process of using svn. All the code is placed on the server, and each colleague pulls the code to the local according to the url through checkout, or changes the code and submits it. It is a single central server. So this management model is called centralized, but centralized has a fatal flaw, that is, the single point of failure of the central server. If it happens, all employees cannot submit or update the code, and cannot work together. In order to solve this problem, distributed will come into being

Second, the distributed version management system
Write picture description here
of distributed and centralized biggest difference is that he has no concept of "central server", each person's computer is a complete repository, the principle that: "The client does not fetch the latest version of File snapshots, instead of mirroring the original code warehouse completely.” This greatly improves security. If a machine goes down, you can get the complete code from others. However, in actual work, there is still a "central server" that serves as a "central server", but this server is only used to facilitate everyone to "exchange" and modify. Without him, everyone can also work, but it is not convenient.

Command line commonly used in Git?


Commands related to remote warehouses
1. git pull: pull code
2. git push: push code
3. git clone: ​​clone code

Local related commands:
1. git init: create a local warehouse and establish an association with a remote warehouse
2. git branch: view the branch
3. git checkout "branch name" to switch branches
4. git checkout -b "branch name" to create And switch branches
5. git merge merge branches

Commands related to submitting code:
1. git status Check the status and find that there is red code, which is the modified place.
2. git add -A Put the modified code in the temporary storage area. After executing 1, you will find the red code
Turned green 3. git commit -m "comment" Submit the code to the local warehouse

summary


Today I recorded a little bit of what Mr. Zhang told me last time. Git also has more powerful branch management. In the next blog post, draw a few pictures to summarize and summarize.

Guess you like

Origin blog.csdn.net/cd18333612683/article/details/79072634