Git project learning --01- (Git combat, Git learning, Git three regions)

1, Git combat

What is Git

  • Git is a distributed version control software.
  • Software, similar to QQ, office and other tools installed on your computer in order to use;
  • Version control, similar to the thesis, writing copy, video clips, etc., need to repeatedly modify and retain the original historical data;
    - Distributed
    - copy the folder
    - a local version control
    - Centralized version control
    - Distributed Version Control

Install Git
online installation tutorial, download links are as follows:
Git for Windows

2, Git learning

The first stage: write code
version control

To manage the folders into the
right-Git Bash Here

Here Insert Picture Description

1. Initialization

git init

2. The state file management directory

git status

Here Insert Picture Description
3. Manage the specified file

the Add index.html git
git the Add. (Adding to manage all modified files)

Here Insert Picture Description

Personal Configuration: user name, email
git config --global user.email "[email protected]"
git config --global user.name "the Name Your"

4. Generate version

Status Git
Git the commit -m 'description'

5. View version

git log

Here Insert Picture Description
The complete process is as follows:
Here Insert Picture Description

The second stage: to explore new features

the Add git
git the commit -m "v2 version"

The third stage: Rollback feature

1. Before you roll back to version

log git
git version number of the RESET --hard

Here Insert Picture Description

2. After the rollback version

reflog git
git version number of the RESET --hard

Here Insert Picture Description

3, summary

Git three regions (important)
Here Insert Picture Description
files 1. Modifications (red state) changes back to normal status
, ie: workspace -----> staging area

Checkout git
git Checkout - - name of the file
note the file name in front of a space

Here Insert Picture Description
2. Managed File (green state) changes back are subject to change file (red state)
namely: the staging area -----> Workspace

the RESET the HEAD git
git the RESET the HEAD file name

Here Insert Picture Description

Published 60 original articles · won praise 9 · views 5039

Guess you like

Origin blog.csdn.net/weixin_42118531/article/details/104766789