PS G:\DOC\GitDoc> git init
Reinitialized existing Git repository in G:/DOC/GitDoc/.git/
git clone [ 连接 ] 克隆仓库
基本用法
git status 查看状态
PS G:\DOC\GitDoc> git status
On branch master
No commits yet
Untracked files:
(use "git add <file>..." to include in what will be committed)
"Git\344\275\277\347\224\250\346\225\231\347\250\213.md"
nothing added to commit but untracked files present (use "git add" to track)
git add . 将所有修改添加至暂存区
PS G:\DOC\GitDoc> git add .
git add [ File name ] 将指定文件添加至暂存区
PS G:\DOC\GitDoc> git add HowToUseGit.md
git commit -m " 备注 " 提交版本
PS G:\DOC\GitDoc> git commit -m "Contribute how to use Git tools."
[master (root-commit) 3ccc1ff] Contribute how to use Git tools.
1 file changed, 55 insertions(+)
create mode 100644 "Git\344\275\277\347\224\250\346\225\231\347\250\213.md"
git log 查看历史版本
PS G:\DOC\GitDoc> git log
commit 3ccc1ff91f3e2a6f9ed5908f414717893d9e3928 (HEAD -> master)
Author: GiottoLee <giottolee@outlook.com>
Date: Sun Apr 7 21:17:44 2019 +0800
Contribute how to use Git tools.
git log -p 查看历史版本附加详细信息
PS G:\DOC\GitDoc> git log -p
commit 3ccc1ff91f3e2a6f9ed5908f414717893d9e3928 (HEAD -> master)
Author: GiottoLee <giottolee@outlook.com>
Date: Sun Apr 7 21:17:44 2019 +0800
Contribute how to use Git tools.
diff --git "a/Git\344\275\277\347\224\250\346\225\231\347\250\213.md" "b/Git\344\275\277\347\224\250\346\225\231\347\250\213.md"
new file mode 100644
index 0000000..dc41cd9
--- /dev/null
+++ "b/Git\344\275\277\347\224\250\346\225\231\347\250\213.md"
@@ -0,0 +1,55 @@
+# Git使用教程
+
+## **配置Git**
+
+- ### git --version  查看Git版本
+> PS G:\DOC> git --version
+git version 2.21.0.windows.1
+
...
+
+- ### git add .  将所有修改添加至暂存区
\ No newline at end of file
git status 查看当前状态
PS G:\DOC\GitDoc> git status
On branch master
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
modified: "Git\344\275\277\347\224\250\346\225\231\347\250\213.md"
no changes added to commit (use "git add" and/or "git commit -a")
git checkout 版本号 穿越到指定的历史节点
PS G:\DOC\GitDoc> git checkout f921330
git checkout - 回到上一个版本节点
PS G:\DOC\GitDoc> git checkout -
三种状态
Modified 修改状态
Staged 暂存状态
Committed 提交状态
标签Tag
git tag 查看标签
PS G:\DOC\GitDoc> git tag
NotFinished
git tag -a [ 标签名 ] -m “备注” 添加标签
PS G:\DOC\GitDoc> git tag -a NotFinished -m "New content added"
git tag -a [ 标签名 ] -m “备注” [ 版本号 ] 添加标签
PS G:\DOC\GitDoc> git tag -a NotFinished -m "New content added" f2165
git show [ 标签名 ] 查看某标签的详细信息
PS G:\DOC\GitDoc> git show NotFinished
tag NotFinished
Tagger: GiottoLee <giottolee@outlook.com>
Date: Sun Apr 7 21:54:26 2019 +0800
New content added
commit 0c308273691037c07875a3e1239670e94d361722 (HEAD -> master, tag: NotFinished)
Author: GiottoLee <giottolee@outlook.com>
Date: Sun Apr 7 21:53:10 2019 +0800
New content added.
diff --git "a/Git\344\275\277\347\224\250\346\225\231\347\250\213.md" "b/Git\344\275\277\347\224\250\346\225\231\347\250\213.md"
index dc41cd9..5f97e4b 100644
--- "a/Git\344\275\277\347\224\250\346\225\231\347\250\213.md"
+++ "b/Git\344\275\277\347\224\250\346\225\231\347\250\213.md"
@@ -3,8 +3,10 @@
## **配置Git**
- ### git --version  查看Git版本
-> PS G:\DOC> git --version
+```
+PS G:\DOC> git --version
git version 2.21.0.windows.1
+```
<br/>
@@ -14,7 +16,8 @@ git version 2.21.0.windows.1
- ### git comfig --list   查看当前所有项目
-> PS G:\DOC> git config --list
+```
+PS G:\DOC> git config --list
core.symlinks=false
core.autocrlf=true
core.fscache=true
@@ -28,14 +31,17 @@ git version 2.21.0.windows.1
http.sslcainfo=F:/Git/mingw64/ssl/certs/ ca-bundle.crt
credential.helper=manager
user.name=GiottoLee
+```
<br/>
## **创建仓库**
- ### git init   初始化仓库
-> PS G:\DOC\GitDoc> git init
+```
+PS G:\DOC\GitDoc> git init
Reinitialized existing Git repository in G:/DOC/GitDoc/.git/
+```
- ### git clone [ *连接* ] &emsp; 克隆仓库
@@ -44,12 +50,109 @@ Reinitialized existing Git repository in G:/DOC/GitDoc/.git/
## **基本用法**
- ### git status   查看状态
->PS G:\DOC\GitDoc> git status
+```
+PS G:\DOC\GitDoc> git status
On branch master
No commits yet
Untracked files:
(use "git add <file>..." to include in what will be committed)
"Git\344\275\277\347\224\250\346\225\231\347\250\213.md"
nothing added to commit but untracked files present (use "git add" to track)
+```
-- ### git add .  将所有修改添加至暂存区
\ No newline at end of file
+- ### git add .  将所有修改添加至暂存区
+```
+PS G:\DOC\GitDoc> git add .
+```
+
+- ### git add [*File name*]  将指定文件添加至暂存区
+~~~
+PS G:\DOC\GitDoc> git add HowToUseGit.md
+~~~
+
+- ### git commit -m "*备注*"   提交版本
+```
+PS G:\DOC\GitDoc> git commit -m "Contribute how to use Git tools."
+[master (root-commit) 3ccc1ff] Contribute how to use Git tools.
+ 1 file changed, 55 insertions(+)
+ create mode 100644 "Git\344\275\277\347\224\250\346\225\231\347\250\213.md"
+```
+
+- ### git log   查看历史版本
+```
+PS G:\DOC\GitDoc> git log
+commit 3ccc1ff91f3e2a6f9ed5908f414717893d9e3928 (HEAD -> master)
+Author: GiottoLee <giottolee@outlook.com>
+Date: Sun Apr 7 21:17:44 2019 +0800
+
+ Contribute how to use Git tools.
+```
+
+- ### git log -p   查看历史版本附加详细信息
+~~~
+PS G:\DOC\GitDoc> git log -p
+commit 3ccc1ff91f3e2a6f9ed5908f414717893d9e3928 (HEAD -> master)
+Author: GiottoLee <giottolee@outlook.com>
+Date: Sun Apr 7 21:17:44 2019 +0800
+
+ Contribute how to use Git tools.
+
+diff --git "a/Git\344\275\277\347\224\250\346\225\231\347\250\213.md" "b/Git\344\275\277\347\224\250\346\225\231\347\250\213.md"
+new file mode 100644
+index 0000000..dc41cd9
+--- /dev/null
++++ "b/Git\344\275\277\347\224\250\346\225\231\347\250\213.md"
+@@ -0,0 +1,55 @@
++# Git使用教程
++
++## **配置Git**
++
++- ### git --version  查看Git版本
++> PS G:\DOC> git --version
++git version 2.21.0.windows.1
++
+
+...
+
++
++- ### git add .  将所有修改添加至暂存区
+\ No newline at end of file
+~~~
+
+
+- ### git status   查看当前状态
+```
+PS G:\DOC\GitDoc> git status
+On branch master
+Changes not staged for commit:
+ (use "git add <file>..." to update what will be committed)
+ (use "git checkout -- <file>..." to discard changes in working directory)
+
+ modified: "Git\344\275\277\347\224\250\346\225\231\347\250\213.md"
+
+no changes added to commit (use "git add" and/or "git commit -a")
+```
+
+- ### git checkout *版本号*   穿越到指定的历史节点
+```
+PS G:\DOC\GitDoc> git checkout f921330
+```
+
+- ### git checkout -   回到上一个版本节点
+~~~
+PS G:\DOC\GitDoc> git checkout -
+~~~
+
+<br/>
+
+## **三种状态**
+
+1. Modified &emsp; 修改状态
+2. Staged   暂存状态
+3. Committed   提交状态
+
+<br/>
+
+## **标签Tag**
+
+- ### git tag -a [*标签名*] -m "*备注*"
\ No newline at end of file
git checkout [ 标签名 ] 回退到该标签的版本
PS G:\DOC\GitDoc>git checkout NotFinished
分支Branch
git branch [ 分支名 ] 创建分支
PS G:\DOC\GitDoc>git branch SubLine
Switched to branch 'SubLine'
git checkout -b [ 分支名 ] 创建并切换至分支
git checkout master 回到默认分支
PS G:\DOC\GitDoc>git checkout master
Switched to branch 'master'