Video learning address

www.bilibili.com/video/BV15J…

Version control

  • Centralized (SVN) advantage: The code is stored on a single server for easy management. The SVN stores different files each time, requiring small hard disk space but slow rollback speed. Disadvantages: A single point of failure of the central server causes all historical records to be lost. Server down: Code written by employees cannot be guaranteed
  • Distributed (Git) clients don’t just take a snapshot of the latest version of the file, but make a complete copy of the code repository. Instead of storing differences between versions, it stores indexes, which require less disk space, so each client can store the history of the entire project. Git takes snapshots (indexes) every time and requires a relatively large amount of hard disk space, but the Git team has compressed the code so much that the actual space required is not much larger than SVN. However, Git rollback is extremely fast.

Introduction of Git

Download and install

git-scm.com/downloads

  • How do I verify the installation

Click the right mouse button to confirm the installation.

  • View the current version of Git you downloaded

Git Bash here $Git –version

Git Configuration

The configuration is done only once, and the existing configuration will be used for each subsequent upgrade.

  • The user information

These are mainly usernames and emails, and each submission is included in the history

$ git config --global user.name "RainaCoder"

$ git config --global user.email [email protected]

  • Viewing existing Configurations

$ git config --list

You can view the information about the newly configured user

Linux Basic Commands

Regions and objects

area

  • Workspace: native code
  • The staging area
  • repository

object

  • Git object
  • The tree object
  • Submit the object

Git command

Basic Linux commands

clear: Echo 'test Content ': echo 'test content'>example. TXT: create a TXT file ll: put subfiles & subdirectories in the current directory on the console find directory name: Find directory name -type f: Tils files in the corresponding directory on the console rm File name: Deletes files mv Source files Rename files: renames cat files URL: View the content of the corresponding file URL of the VIm file (in English mode) Press I to edit the file in insert mode. Press ESC & Press: to execute the command. Forced exit (not saved) wq Save and exit set nu Set the line numberCopy the code

Initialize the new repository

Action: Create a new Git folder, open Git in that folder (right click Git bash here), and type Git init

You may not see any changes in the folder at this point, but you’ll need to click view – to show the hidden files in the folder. This will bring up a file named.git, which is the final version library.

Git Directory Analysis

  1. Hooks: Directory contains client-side or server-side hook scripts (things that need to be done before submitting code)
  2. Info: contains a global exclusion file
  3. Logs: Saves log information
  4. Objects: Directories store all data contents
  5. Refs: The directory stores Pointers to the submitted objects of the data (branches)
  6. Config: the file contains project-specific configuration options
  7. Description: Displays the description of the warehouse
  8. HEAD: file indicates the branch currently being detected
  9. Index: information about the temporary storage area of the file