1、 Version control
Revision controlIt is a kind of technology used to manage the modification history in the development process, to view the change history record conveniently, and to backup to restore the previous version of software engineering.
1. Realize multi person collaborative development across regions
2. Track and record the history of one or more documents
3. Organize and protect your source code and documents
4. Statistical workload
5. Parallel development to improve efficiency
6. Track and record the whole software development process
7. Reduce the burden of developers, save time, and reduce human errors
Technology for managing multi person collaborative development projects
Common version control tools
3.CVS（Concurrent Versions System）
4.VSS（Micorosoft Visual SourceSafe）
5.TFS（Team Foundation Server）
6.Visual Studio Online
Local version control
Record each update, you can make a snapshot of each version, or record the patch file
Centralized version control SVN
All data is saved to the server, and the collaborative developers update or upload their own changes from the server
Distributed version control Git
All versions of the repository are synchronized to each local user, and everyone has all the code
The main difference between GIT and SVN
The Chinese and English server used in SVN version library needs to obtain the latest version from the central server, and then work. After completing the work, the work done by itself will be pushed to the central server.
Git is a distributed version control system. There is no central server. Everyone’s computer is a complete version library, and there is no need to connect to the Internet when working.
Git is the most advanced distributed version control system in the world
2、 Install Git
1. Git interface
1) Git bash: Unix and Linux style command line, most used, most recommended
2) Git CMD: Windows style command line
3) Git GUI: git of graphical interface, not recommended for beginners, try to be familiar with common commands first
2. Git configuration
Git related configuration files
1) git config — System — list system level
2) git config — global — List Global
Set up user name and mailbox (required)
1）git config –global user.name “Username” user name
2）git config –global user.email [email protected] mailbox
Environment variables are only used globally and are configured automatically during installation
3、 Git basic theory (core)
1. Work area
Working directory, stage / index, repository or git directory.
If you add the remote git repository (remote directory), it can be divided into four working areas.
1) workspace: the work area, where the project code is usually stored.
2) index / stage: the temporary storage area is used to temporarily store changes. In fact, it is only a file to save the information to be submitted to the file list.
3) Repository: the warehouse area (or local warehouse), where the data is stored safely. There are all versions of data submitted. Where head points to the latest version put into the warehouse.
4) remote: remote warehouse, server hosting code, which can be simply regarded as a computer used for data exchange in the project.
ref:refs/heads/master Main branch
1) add and modify files in the directory;
2) put the files that need version management into the temporary storage area; git add
3) submit the files in temporary storage area to git warehouse
Git managed files have three states: modified, staged and committed
2. Git command
1) temporary command: git add is submitted to the temporary storage area
2) submit command: git commit – M submit the contents of the temporary storage area to the local warehouse
Build local warehouse
3) git initialization: git init
Clone remote warehouse
4) git project clone: git clone [url]
View file status
5) query all file information: git status
6) query the specified file information: git status [file name]
3. Ignore files
Create the “. Gitignore” file in the main directory, which has the following rules
1) ignore empty lines in the file or lines beginning with ා, will be ignored
2) you can use Linux wildcards, such as asterisk (*) to represent any number of characters, and question mark (?) Represents a character, and bracket [ABC] represents an optional range of characters,
Optional, string 1 stands for the curly bracket.
3) if the name is preceded by an exclamation mark (!) , represents an exception rule and is not ignored.
4) if the name is preceded by a path separator (/), it means that the files in this directory are to be ignored, while the subdirectories are not.
5) if the name is followed by a path separator (/), it means to ignore the subdirectory of the name in this directory, not the file.
4、 Gitee code cloud installation and use
1. Register gitee and GitHub accounts
2. Set the SSH public key bound by the machine to realize password free login! (password free login is important)
Public key setting: enter the directory C: user / adnubstractor \. SSH
SSH keygen: generating public key
3. Add the public key information to the code cloud account
4. Use code cloud to create your own warehouse
5、 Idea integration Git
1. Create a new project and bind GIT
Copy our remote git file directory to the project
2. Modify the file and use idea to operate GIT
3. Submit test
6、 Git branch common instructions
1. List all local branches
2. List all remote branches
git branch -r
3. Create a new branch, but still stay in the current branch
git branch [branch-name]
4. Create a new branch and switch to it
git checkout -b [branch]
5. Merge the specified branch to the current branch
git merge [branch]
6. Delete branch
git branch -d [branch-name]
7. Delete remote branch
git push origin –delete [branch-name] git branch -dr [remote/branch]