"Git Community book" Learning Notes

Source: Internet
Author: User
Tags sha1 sha1 hash version control system

intends to learn a comprehensive git knowledge, compare the information on the Internet, the "Git Community book" is the appropriate length, covering a comprehensive, that is it.
Chapter1 Introduction

The 1.Git is a fast distributed version control system.
2. All files used to represent the project's historical information are indexed by a 40-character (40-digit) "Object name".
Each "object name" is computed as a SHA1 hash of the "object" content, (SHA1
is a cryptographic hashing algorithm).
3. The difference from SVN
The difference between git and most of the version control systems you're familiar with is huge. Maybe you're familiar with subversion, CVS, Perforce, mercurial, and so on, he
Delta Storage Systems, which means that they store the difference between each commit (commit). Git is just the same
It will record the entire contents (snapshot) of each file you submit.
4.GIT Directory and working directory
The ' git directory ' is a directory that stores all the history and meta information for your project. Each project can have only one ' git directory '.
Git's ' working directory ' stores the files you now check out (checkout) for editing. When you switch between different branches of a project, the text in the working directory
Items are often replaced and deleted. All historical information is stored in the ' Git directory '; The working directory is used only to temporarily save the checked-out (checkout) file,
You can edit the working directory file until the next commit (commit)


Chapter2 First Step

1. Install git
2. Get a git repository
Now that we've set everything up, we need a git repository. There are two ways to get it: Clone (clone, copy) from an existing Git repository, or create a new repository to version control files that are not versioned.
3. Branching and merging
A git repository can maintain many development branches. Now let's create a new branch called "Experimental":
$ git Branch experimental
If you run the following command:
$ git Branch
You will get a list of all the branches present in the current repository:
Experimental
* Master
The "experimental" branch is the one you just created, and the "master" branch is the main branch that the GIT system creates by default. An asterisk ("*") identifies what you are working on
Under Branches, enter:
$ git checkout experimental
Switch to the "experimental" branch, edit one of the files in it, commit the changes, and finally switch back to the "master" branch.
(Edit file)
$ git commit-a
$ git Checkout Master
You can now look at the changes you have made under the "experimental" branch, because you are now switching back to the "master" branch, so the original changes don't exist.
You can now make a few different changes under the "master" branch:
(Edit file)
$ git commit-a
At this point, two branches have their own different modifications (diverged); we can combine the "experimental" and "master" two branches with the following commands:
$ git Merge experimental
If there is no conflict between the two-branch changes (conflict), then the merge is complete. If there is a conflict, enter the following command to view the current
What files have conflicts:
$ git diff
When you edit a conflicting file, the conflict is resolved and you can submit it:
$ git commit-a
Once you have submitted the merged content, you can view it:
$ gitk
After performing the GITK there will be a very nice graphical display of the project history.
You can then delete your "experimental" branch (if you prefer):
$ git branch-d experimental
Git branch-d can only delete branches that have already been merged by the current branch. If you want to forcibly delete a branch, use Git branch–d;
Suppose you want to force the deletion of a branch called "Crazy-idea":
$ git branch-d Crazy-idea
Branching is very lightweight and easy, so it's easy to try it out.
How to merge
You can use the following command to merge two separate branches: Git mer


Chapter3 Basic Usage
CHAPTER4 Intermediate Skills
CHAPTER5 Advanced Skills
CHAPTER6 git eco-system
Chapter7 principle Analysis

"Git Community book" Learning Notes

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.