June 30 Study Notes:
Version Control System git:
1. application:
Record all historical changes of a file
Can be restored to any historical status at any time
Collaborative development or repair by multiple users
Error Recovery
Multi-function Concurrent Development
2. Category:
Local Version Control System
Centralized Version Control System
Distributed version control system
3. Basic concepts:
Repository-stores all files and their historical information
Checkout -- retrieve or switch to a specified version of the file
Version -- Record to identify a version (number or other code)
Tag -- record a major version (1.0 2.0 3.0)
Local version control system (LVCs)
For example, RC (available in many Linux systems)
Advantage: simple, built-in in many systems
Suitable for managing local files
(Such as configuration files, articles, letters, simple documents, etc)
Disadvantages:
It is suitable for managing a small number of files and does not support project-based management.
The Supported file types are few and single
Network is not supported, and multi-person collaboration cannot be achieved
Centralized version control system (CVCs)
CVS
Advantages:
Suitable for collaborative development by multiple teams
Centralized management of code sets
Disadvantages:
Single point of failure (can cluster or backup be supported ?)
Must work online and cannot work locally on a single machine
Distributed version control system (DVCs)
Such as git
Advantages:
Suitable for collaborative development by multiple teams
Centralized code management
Work Offline
Every computer is a complete warehouse
Git principle-snapshot. Rather than saving (patching)
-File identification and operations (identify file changes through the checksum algorithm, most operations are to add data, even if it is deleted by mistake, retrieve it through previous versions !!)
-File status and work area (edit and modify in the working directory --> Save the modified file in the temporary storage area --> Save the final file to the repository to become a new version, and visible to others)
Git add hellogit. Rb
How to install git (git-scm.com) on different operating systems)
Linux:
Yum list | grep git
Yum install-y git
Sudo apt-Get install git
Git -- version
..........
......
After installation
Git-Basic settings
1. Set the user name
Git config -- global user. Name "itercast"
2. Set User email
Git config -- global user. Email "[email protected]"
3. View settings
Git config -- list
Git Command help
Git help
Git help specific commands
For example, git help add
How to initialize a new git Repository
1. Create a folder (or use an existing folder)
Mkdir xxoo
2. initialize git in the folder and create a git Repository
CD xxoo
Git init
Ls-
CD. Git
Ls
.....
....
Add a new file to the repository:
For example:
Touch readme
Vim hellogit. Rb
Puts "Hello git"
Ls
Git status
Git add readme
Git add hellogit. Rb
Git status
Git commit-M "init repo"
Git status
Git log
Directly submit to the repository ("no temporary storage" means that git automatically completes temporary storage)
Git commit-a-m "Modify hellogit"
For example
Vim readme
"This is a girl"
Ls
Git status
Git commit-a-m "Modify hellogit"
Git status
Delete an object
1. delete an object
Rm readme
2. delete files from git (but the files are still recorded in the GIT repository history, that is, only files of the current version are deleted)
Git RM readme
3. Submit the operation
Git commit-M "delete readme"
Rename a file
Git MV hellogit. RB helloworld. Rb
Git commit-M "RENAME hellogit. RB file"
Git remote repository (that is, the GIT repository file stored on the server)
Access a remote repository through an access protocol over the network
The access protocols include:
Local
SSH
Git
HTTP/https
1. Use the existing git network repository Service
Code hosting service:
GitHub (for example, if you submit your work here and go to the company for an interview, you will say that there is my work in this warehouse, haha !!)
Bitbucket
2. Build your own git repository Server