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:
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.
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.) )
Show middle Status:git status to see if there is any content submitted.
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).
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.
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.
generate a series of separate commits in the repository: git log
View more detailed information about a specific submission: git show submission code
provides a concise, single-line summary of the current development branch:git show-branch–more=10 ( represents an additional version of the Ten)
View commit Variance : Git diff + two versions commit full ID name.
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
clone:git clone dir1 dir2
View two versions minor differences
Ls–lsa Dir1 Dir2
Diff–r Dir1 Dir2
configuration files: descending order of precedence
The. Git/config Repository-specific configuration settings, which can be modified with the-file option, are the default options that have the highest priority.
~/.gitconfig User-specific configuration settings, which can be-global modified.
/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"