Acquaintance Git: Git to download and use

Download Git (window system)

Baidu network disk download (git64 bit):
link: https://pan.baidu.com/s/1FrZQRKIEWP5rxVGC_fa1vQ extraction code: haup
Here Insert Picture Description
Git official website to download:

https://git-scm.com/download

Here Insert Picture Description
Here Insert Picture Description

Git verify the installation was successful

Method 1: Right-click on the desktop, appears in Figure
Here Insert Picture Description

Embodiment 2: Open a command line window (window + R)
Input:git
Here Insert Picture Description

Create Repository

What is the repository of it?
版本库Also known as 仓库the English name repository, can be simply interpreted as a directory, all files in this directory can be inside Git to manage, modify each file, delete, Git can track order history can be traced any time or in the future at some point you can "restore."
Prelude
Right-click on the desktop using the git Bash enter
Here Insert Picture Description
Configuring User Information

$ git config --global user.name "名字"
$ git config --global user.email "邮箱"

Here Insert Picture Description

Switching to the appropriate directory (for example: D zGit disk directory)

cd d:\zGit

Here Insert Picture Description
Here Insert Picture Description
Step one: Create an empty directory ( 路径、名称最好不要有中文)

$ mkdir 目录名
$ cd 目录名//进入目录
$ pwd//用于显示当前目录

Step two: The git initcommand to become this directory can manage Git repository

$ git init

The current directory more than a .gitdirectory, the directory is to track and manage Git repository, all right, do not manually modify the file or folder, or change the mess, put the Git repository to destroy.
If you do not see .git directory, it is because this directory is hidden by default, use ls -ahthe command you can see.

Note:
Do not use the built-in Windows Notepad to edit any text file

Put a file into the Git repository

First, prepare a file (this file is placed in the directory created earlier).

The first step: command git addtells Git, to add files to the repository

$ git add 文件名(含后缀名)

Step 2: Use the command git committells Git, the submission of documents to the repository

$ git commit -m "wrote a 文件名(不含文件名) file"

git commitCommand, -menter the explanation behind this is submitted

Why add files Git needs add, commita total of two steps it? Because commit many files at once can be submitted

$ git add file1.txt
$ git add file2.txt file3.txt
$ git commit -m "add 3 files."

Icon
Here Insert Picture Description

Here Insert Picture Description

Published 137 original articles · won praise 26 · views 30000 +

Guess you like

Origin blog.csdn.net/weixin_40119412/article/details/104256416