[Git experience] git principles and basics, experience git principles
Principle: Distributed version control systems such as Git, Mercurial, Bazaar, and Darcs. The client does not only extract the latest version.
Instead, it completely mirrors the original code repository. In this way, any server that works collaboratively fails,
After the event, you can use any image to restore it from a local repository. Because every extraction operation is actually performed on the code repository
Complete backup.
Furthermore, many such systems can specify to interact with several different remote code repositories. From this point, you can
In the project, they work with different teams. You can set different collaboration processes as needed, such as hierarchical modeling.
In the previous centralized system.
2. Fast Speed
2. Simple
2. Non-linear concurrency (Thousands of parallel development branches allowed)
2. Completely distributed
Basics:
1. Non-differential comparison,Directly record snapshots
Git only cares about whether the overall file data changes, while most other systems only care about the specific differences in file content. In other versions, the Controller saves the modified file and the modified content.
Other system diagrams
Git does not store the different data before and after the changes. In fact, Git is more like recording a changed file as a snapshot in a micro
. Each time an update is submitted, it will view the fingerprint information of all files, take a snapshot of the file, and save
The index pointing to this snapshot. To improve performance, if the file remains unchanged, Git does not save it again, but only performs
1.
Git saves the file snapshot for each update
2. All operations are performed locally.
Most operations in Git only need to access local files and resources without connecting to the network. Save the modification
In the local cache area, Git stores historical updates of all current projects on the local disk. It is also easy to view historical versions without the need
To connect to the Internet, you need to connect to the Internet only when you need to push the data in the local cache area to the server.
However, other version controls cannot leave the network. For example, if you use cvs, you can modify and add them locally, but you need to compare them.
Network support is required for previous versions or users who have modified the version. Sometimes access is slow.
3. ensure data integrity
The data stored in git must be verified and computed, and the result is used as the unique identifier and index of the data. That is, modify the Directory
Or, git is completely aware of the content. Git uses the SHA-1 algorithm to calculate the data checksum.
4. Status in git data 3
Modified: in the work environment, add, delete, modify, and save it to the work area.
Staged: Submit the code of the Work interval to the local cache, but it has not been submitted to the server trunk.
Committed: Synchronize to the server and connect to the Internet.
[Github] git remote add origin what is the origin IN git?
Origin is the name of the default remote version library, which is usually used by everyone. You can also use another name, such as thisIsNotOrigin or something, with corresponding settings in. git/config.
What is the difference between git init and git -- bare init?
For personal use, use git init. At this time, your workspace is also here. If you want to create a fixed address for everyone to use, use -- bare on the server. As you can see, the. git directory created by init is similar to that created by -- bare.