Git notes-"Git versioning management"

Source: Internet
Author: User
Tags configuration settings version control system

Git is a free, open source, distributed version control system that was first created by Linus Torvalds to manage the development of Linux Kernels.

version control System ( VSS)/ source code Manager (SCM)/ revision control system (RCS): refers to a different version of the tool that can manage and track software code and other similar content.

There are two ways to build the underlying technology of the Git repository. One is from the beginning · start the creation, populate it with existing content, and clone a previous repository.

First, create from scratch:

    1. To Create an initialization repository:git init

Convert your directory into a git repository . Whether the directory is empty or not. To show that the directory is a git repository ,the git init command creates a hidden directory in the top-level directory of the project, called . Git. git puts all the changes in this directory.

    1. to add a file to the repository: git add filename

consciously separate important files from temporary documents. Git Add. is to add all the files in the current directory to the repository. So far,git just staged these files, which is the intermediate step before committing. (git separates add from commit to avoid frequent changes.) )

    1. Show middle Status:git status to see if there is any content submitted.

    2. commit:git commit–m "Initial content" –author= "Wangxu<[email protected]>"

In addition to the actual changes in the contents of the directory and the file,git also logs some other metadata at each commit, including the log messages and the author who made the change. You can provide a log on the command line, but it is more typical to create a message during an interactive compiler session. (Set editor export Git_editor=vim).

    1. Configuration Submission

git config user.name "Wangxu"

git config user.email [email protected]

use the git config command to save your identity in the configuration file.

    1. Modify the file and submit it again ; git commit file

because the file already exists in the repository, there is no need to execute the Add command and then tell the index to the file. When a command file is submitted directly at the command line, the file changes are automatically captured. The general git commit does not work in this case. However, when the editor appears, enter a record information and exit the editor, and now there are two versions of the files in the repository.

    1. generate a series of separate commits in the repository: git log

    2. View more detailed information about a specific submission: git show submission code

    3. provides a concise, single-line summary of the current development branch:git show-branch–more=10 ( represents an additional version of the Ten)

    4. View commit Variance : Git diff + two versions commit full ID name.

    5. Deletion and renaming of files within the repository

git rm file

Git commit–m "Remove file" ( it takes two steps to delete and add )

git move file1 file2

Git commit–m "mv File1 to File2" ( in either case, the staged change must then be committed )

Second, create a copy of the repository

    1. clone:git clone dir1 dir2

    2. View two versions minor differences

Ls–lsa Dir1 Dir2

Diff–r Dir1 Dir2

configuration files: descending order of precedence

    1. The. Git/config Repository-specific configuration settings, which can be modified with the-file option, are the default options that have the highest priority.

    2. ~/.gitconfig User-specific configuration settings, which can be-global modified.

    3. /etc/gitconfig This is a system-wide configuration setting.

the basic concept of Git

Git repository:

is a simple database that contains all the revisions and historical information used to maintain and manage the project. the Git repository not only provides a complete copy of all the files in the repository, but also a copy of the repository itself. In the repository,Git maintains two primary data structures: Object libraries and indexes. All of these repository data resides in a hidden subdirectory named. Git in the root directory of the working directory . The object library can replicate efficiently while replicating, which is also a technique to support full distribution. The index is temporary information, is private to the repository, and can be created and modified as needed.


Git notes-"Git versioning management"

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.