commit 0c4b01294032f11e829079ca658114c69a65686f Author: AaronXu <718827633@qq.com> Date: Thu Nov 6 16:43:42 2025 +0800 init diff --git a/01.Markdown.md b/01.Markdown.md new file mode 100644 index 0000000..7fac2bd --- /dev/null +++ b/01.Markdown.md @@ -0,0 +1,341 @@ +# Markdown + +## 1. 为什么不用word或者纸笔? + +### 1.1 记笔记的目的 + +> “你是为今天记笔记,还是为未来建立知识库?” + +很多同学记笔记只是为了**应付考试**, + 但学 IT 的笔记,应该是为了**长期积累、复盘、提升自我效率**。 + +Markdown 就是帮助你做到这一点的工具。 + +### 1.2 记录“代码与操作过程” + +| 比较项 | 纸笔笔记 | Markdown 笔记 | +| -------- | ------------------------ | --------------------------------------- | +| 记录代码 | ❌ 手抄代码既慢又容易写错 | ✅ ```python print("Hello") ``` 一行搞定 | +| 记录截图 | ❌ 手绘图太耗时 | ✅ Typora 直接拖入截图 | +| 搜索复用 | ❌ 翻笔记很慢 | ✅ Ctrl+F 秒搜到关键字 | +| 更新修改 | ❌ 涂改麻烦 | ✅ 随时编辑、版本管理 | +| 云同步 | ❌ 无法共享 | ✅ 可推送至 Gitee/GitHub | + +📌 **结论**:纸笔适合做思维草稿,而不适合整理和保存技术内容。 + +### 1.3 word的问题 + +Word 很强大,但不适合技术笔记的原因主要有五个: + +#### 1️⃣ 文件臃肿 & 格式混乱 + +- 每次复制代码,格式都会错乱。 +- Tab、空格、缩进会被破坏。 +- 导出和跨设备阅读都很麻烦。 + +#### 2️⃣ 不利于版本管理 + +- 改一处就得重新保存一份 `.docx`。 +- 没法查看“上一个版本改了什么”。 +- Git 对二进制文件(如 Word)无法对比差异。 + +#### 3️⃣ 不适合代码展示 + +- 代码块没有语法高亮。 +- 排版与复制体验差。 +- 无法在命令行或项目文档中直接使用。 + +#### 4️⃣ 不通用 + +- Word 文件只能在有 Office 的地方打开。 +- 而 Markdown 是纯文本,任何系统都能打开。 + +#### 5️⃣ 不专业 + +- 技术行业中,项目文档、README、开发手册,几乎全部使用 Markdown。 + 👉 用 Word 写项目笔记,会显得“像没入门”。 + +### 1.4 md技术人的语言 + +#### ✅ Markdown 的核心价值 + +1. **轻量化** —— 不需要格式菜单,专注内容 +2. **可复用** —— 一份笔记能在网页、PDF、GitHub 都通用 +3. **结构化** —— 用 `#`、`-`、代码块清晰展示知识层次 +4. **自动化** —— 可与工具(如 Typora、Obsidian、Gitee)结合 +5. **版本化** —— 与 Git 完美结合,记录学习历程 + +### 1.5 md的延展能力 + +学习 Markdown,不只是为了“写漂亮的笔记”, +而是在为未来的学习与工作打基础。 + +| 未来场景 | Markdown 的用法 | +| ------------ | ---------------------------------- | +| 📘 写项目文档 | README.md | +| 🧑‍💻 写博客 | 用 Hexo、Hugo、VuePress 等生成网站 | +| 📂 整理知识库 | Obsidian / Typora 笔记体系 | +| 🧠 团队协作 | Git + Markdown 共享文档 | +| 📤 面试准备 | 整理问题集与项目笔记上传 Gitee | + +- 会写 Markdown,就能在技术世界里‘无障碍沟通’。 + +> “纸笔是用来记忆的, +> Word 是用来排版的, +> 而 Markdown,是用来成长的。” + +## 2. Typora + +### 2.1 Typora介绍 + +✅ Typora 的核心理念: + +> “让 Markdown 写起来像 Word,用起来像程序员。” + +| 优点 | 说明 | 举例 | +| -------------------- | -------------------------------- | ------------------------------ | +| 🧭 **所见即所得** | 不需要预览模式,输入即显示排版 | 输入 `#` 立即变标题 | +| 💾 **自动保存与恢复** | 防止误关丢失笔记 | 写完不用 Ctrl+S | +| 📸 **图片拖拽支持** | 拖图片自动插入并复制到本地文件夹 | 适合截图讲解编程步骤 | +| 💻 **代码高亮** | 支持上百种编程语言 | ```python print() ``` 自动高亮 | +| 📂 **导出多格式** | 一键导出 PDF、HTML、Word | 提交作业或打印非常方便 | +| ☁️ **跨平台同步** | 可与 Git、Gitee、云盘结合 | Typora + Git = 学习档案库 | + +📌 对于 IT 专业学生,Typora 是最理想的入门工具,因为: + +- 它的学习曲线平滑; +- 不需要配置环境; +- 兼容所有 Markdown 文件(未来迁移到 Obsidian、VitePress、GitHub 都可无缝衔接)。 + +### 2.2 Typora安装 + +- 下载“特别版”Typora软件 +- 将程序放到某个固定的文件夹中(后续不要改动位置!),完全解压 + +![image-20251106142454358](01.Markdown/image-20251106142454358.png) + +- 解压之后运行关联格式 + +![image-20251106142933376](01.Markdown/image-20251106142933376.png) + +- 找到主程序,创建桌面快捷方式 + +![image-20251106143420044](01.Markdown/image-20251106143420044.png) + +- 双击桌面快捷方式,启动程序 + +![image-20251106145620438](01.Markdown/image-20251106145620438.png) + +### 2.3 建议配置 + +- 开启自动保存 + +![image-20251106150108542](01.Markdown/image-20251106150108542.png) + +- 设置图片保存的位置 + +![image-20251106150208702](01.Markdown/image-20251106150208702.png) + +- md语法的一些设置 + +![image-20251106150248481](01.Markdown/image-20251106150248481.png) + +- 窗口样式,推荐一体化 + +![image-20251106150318542](01.Markdown/image-20251106150318542.png) + +- 彻底配置完成后,关掉重开,生效设置,下面是几个功能 + +![image-20251106150448512](01.Markdown/image-20251106150448512.png) + +![image-20251106150541000](01.Markdown/image-20251106150541000.png) + +![image-20251106150611370](01.Markdown/image-20251106150611370.png) + +## 3. Markdown语法 + +- md文件的格式都是 `.md` 结尾的,新建一个md文件,就可以开始练习md语法了 + +### 3.1 标题 + +Markdown 使用 `#` 号来创建标题,这是从 HTML 的 `

` 到 `

` 标签概念演化而来的。 + +使用 **#** 号可表示 1-6 级标题,一级标题对应一个 **#** 号,二级标题对应两个 **#** 号,以此类推。 + +```markdownn +# 一级标题 +## 二级标题 +### 三级标题 +#### 四级标题 +##### 五级标题 +###### 六级标题 +``` + +### 3.2 文本 + +Markdown 段落没有特殊的格式,直接编写文字就好,**段落的换行是使用两个以上空格加上回车**。 + +#### 3.2.1 加粗 + +使用两个星号 ***\*** 或两个下划线 **__** 包围文字: + +```markdown +这是**粗体文字**使用星号 +这是__粗体文字__使用下划线 +``` + +#### 3.2.2 斜体 + +使用一个星号 ***** 或一个下划线 **_** 包围文字: + +```markdown +这是*斜体文字*使用星号 +这是_斜体文字_使用下划线 +``` + +#### 3.2.3 加粗斜体 + +使用三个星号 ***\**** 或三个下划线 **___**: + +```markdown +*斜体文本* +_斜体文本_ +**粗体文本** +__粗体文本__ +***粗斜体文本*** +___粗斜体文本___ +``` + +- 看下面效果 + +![img](01.Markdown/md3.gif) + +#### 3.2.4 分隔线 + +你可以在一行中用三个以上的星号、减号、底线来建立一个分隔线,行内不能有其他东西。你也可以在星号或是减号中间插入空格。下面每种写法都可以建立分隔线: + +```markdown +*** + +* * * + +***** + +- - - + +---------- +``` + +#### 3.2.5 删除线 + +如果段落上的文字要添加删除线,只需要在文字的两端加上两个波浪线 **~~** 即可,实例如下: + +```markdown +~~不是~~ +``` + +#### 3.2.6 下划线 + +下划线可以通过 HTML 的 `` 标签来实现: + +```markdown +下划线 +``` + +#### 3.2.7 引用块 + +> 引用块用于突出显示重要信息、引用他人观点或创建视觉层次。 +> +> Markdown 区块引用是在段落开头使用 **>** 符号 ,然后后面紧跟一个**空格**符号: + +```markdown +> 区块应用 +> 突出重点 +``` + +#### 3.2.8 高亮 + +文本 ==高亮== 不是标准 Markdown 语法,但许多扩展支持: + +```markdown +这是==高亮文本== +``` + +#### 3.2.9 行内代码标记 + +使用一个反引号 **`** 包围代码: + +```markdown +使用 `git commit` 命令提交代码 +变量 `userName` 存储用户名 +在终端中输入 `npm install` 安装依赖 +``` + +在一行中,如果出现代码,建议使用行内代码标记,比如:`ipconfig /all` 这样的命令 + +### 3.3 超链接 + +链接是使 Markdown 文档具有交互性的关键元素。 + +掌握链接语法能让你创建内容丰富、易于导航的文档。 + +链接使用方法如下: + +```markdown +[链接名称](链接地址) +[链接文字](链接地址 "可选的标题") +``` + +[点我跳转到百度](https://www.baidu.com/) + +### 3.4 插入图片 + +Markdown 图片语法格式如下: + +```markdown +![替代文字](图片路径) +![替代文字](图片路径 "图片标题") +``` + +![MD图标](01.Markdown/image-20251106154347528.png) + +### 3.5 表格 + +Markdown 制作表格使用 **|** 来分隔不同的单元格,使用 **-** 来分隔表头和其他行。 + +语法格式如下: + +```markdown +| 表头 | 表头 | +| ---- | ---- | +| 单元格 | 单元格 | +| 单元格 | 单元格 | +``` + +**我们可以设置表格的对齐方式:** + +- `---:` 设置内容和标题栏居右对齐。 +- `:---` 设置内容和标题栏居左对齐。 +- `:---:` 设置内容和标题栏居中对齐。 + +实例如下: + +```markdown +| 左对齐 | 右对齐 | 居中对齐 | +| :-----| ----: | :----: | +| 单元格 | 单元格 | 单元格 | +| 单元格 | 单元格 | 单元格 | +``` + +- 表格举例 + +| 功能 | 描述 | 状态 | +| ------------------------------- | -------------------- | :--------------: | +| **用户登录** | 支持邮箱和手机号登录 | ✅ | +| *密码重置* | 通过邮箱重置密码 | ⚠️ | +| `API接口` | RESTful API 设计 | ✅ | +| [文档链接](https://example.com) | 查看详细文档 | 📖 | + +## 4. 其他的用法 + +其他用法查看教程:https://www.runoob.com/markdown/ \ No newline at end of file diff --git a/01.Markdown/image-20251106142454358.png b/01.Markdown/image-20251106142454358.png new file mode 100644 index 0000000..f203976 Binary files /dev/null and b/01.Markdown/image-20251106142454358.png differ diff --git a/01.Markdown/image-20251106142933376.png b/01.Markdown/image-20251106142933376.png new file mode 100644 index 0000000..f935e19 Binary files /dev/null and b/01.Markdown/image-20251106142933376.png differ diff --git a/01.Markdown/image-20251106143420044.png b/01.Markdown/image-20251106143420044.png new file mode 100644 index 0000000..000c31d Binary files /dev/null and b/01.Markdown/image-20251106143420044.png differ diff --git a/01.Markdown/image-20251106145620438.png b/01.Markdown/image-20251106145620438.png new file mode 100644 index 0000000..2948665 Binary files /dev/null and b/01.Markdown/image-20251106145620438.png differ diff --git a/01.Markdown/image-20251106150108542.png b/01.Markdown/image-20251106150108542.png new file mode 100644 index 0000000..6ee3ad5 Binary files /dev/null and b/01.Markdown/image-20251106150108542.png differ diff --git a/01.Markdown/image-20251106150208702.png b/01.Markdown/image-20251106150208702.png new file mode 100644 index 0000000..db71aa9 Binary files /dev/null and b/01.Markdown/image-20251106150208702.png differ diff --git a/01.Markdown/image-20251106150248481.png b/01.Markdown/image-20251106150248481.png new file mode 100644 index 0000000..9f0001d Binary files /dev/null and b/01.Markdown/image-20251106150248481.png differ diff --git a/01.Markdown/image-20251106150318542.png b/01.Markdown/image-20251106150318542.png new file mode 100644 index 0000000..ec8eaf4 Binary files /dev/null and b/01.Markdown/image-20251106150318542.png differ diff --git a/01.Markdown/image-20251106150448512.png b/01.Markdown/image-20251106150448512.png new file mode 100644 index 0000000..d2d79e1 Binary files /dev/null and b/01.Markdown/image-20251106150448512.png differ diff --git a/01.Markdown/image-20251106150541000.png b/01.Markdown/image-20251106150541000.png new file mode 100644 index 0000000..7fbad0c Binary files /dev/null and b/01.Markdown/image-20251106150541000.png differ diff --git a/01.Markdown/image-20251106150611370.png b/01.Markdown/image-20251106150611370.png new file mode 100644 index 0000000..4a6c41d Binary files /dev/null and b/01.Markdown/image-20251106150611370.png differ diff --git a/01.Markdown/image-20251106154347528.png b/01.Markdown/image-20251106154347528.png new file mode 100644 index 0000000..7b688f4 Binary files /dev/null and b/01.Markdown/image-20251106154347528.png differ diff --git a/01.Markdown/md3.gif b/01.Markdown/md3.gif new file mode 100644 index 0000000..7e22766 Binary files /dev/null and b/01.Markdown/md3.gif differ diff --git a/02.git.md b/02.git.md new file mode 100644 index 0000000..4c76e76 --- /dev/null +++ b/02.git.md @@ -0,0 +1,489 @@ +# git简介 + +## git的诞生 + +1991年 Linus开创了开源的Linux + +2002年以前 Linus手动合并代码 + +2002年 BitKeeper免费授权 + +2005年 BitKeeper被尝试破解,收回授权 + +2005年 Linus花了两周时间用C写出了git,并且一个月之内将Linux搬迁到git上 + +2008年 GitHub上线 + +## 集中式与分布式 + +集中式 + + CVS、SVN + +分布式 + + Git + +# Git安装 + +git最新版本,没有安装包的话,去官方地址下载 + +https://git-scm.com/ + +一路next直到安装完毕,保持默认的选项 + +安装完毕后,打开windows的`cmd` 命令界面,输入如下命令,来设置自己的用户名和邮箱。 + +```bash +git config --global user.name "Aaron" +git config --global user.email "Aaron@eagleslab.com" +``` + +# 创建版本库 + +版本库又名仓库,英文名**repository** ,你可以简单的解成一个目录,这个目录里面的所有文件都可以被Git管理起来,每个文件的修改、删除,Git都能跟踪,以便任何时刻都可以追踪历史,或者在将来某个时刻可以“还原”。 + +**第一步** 找个空的地方创建一个文件夹 + +**第二步** 在文件夹中打开`cmd`界面,然后输入`git init` 命令把这个目录变成Git可以管理的仓库 + +```cmd +C:\Users\simid\Desktop\testrepo>git init +Initialized empty Git repository in C:/Users/simid/Desktop/testrepo/.git/ +``` + +我们也可以发现,在这个文件夹中会创建一个`.git`的目录, 这个目录是Git来跟踪管理版本库的 + +## 添加文件到版本库 + +这边要注意,git只能追踪文本文件的改动,而二进制文件只能记录大小的变化。 + +**第一步** + +- 在我们的git文件夹中创建一个记事本文件编辑内容 +- 在记事本文件中写一些内容,比如`哈哈哈,大家一起来学习git` +- 使用命令`git add`告诉git,把文件添加到暂存区中 + +```git +git add readme.txt +``` + +执行上面的命令,没有任何显示 + +**第二步** + +用命令`git commit`告诉Git,把文件提交到仓库 + +```git +C:\Users\simid\Desktop\testrepo>git commit -m "write a readme file" +[master (root-commit) 3e22070] write a readme file + 1 file changed, 1 insertion(+) + create mode 100644 readme.txt +``` + +`git commit`后面的`-m`是输入本次提交的说明的,可以输入任何内容,最好是自己能看懂的,这样就可以从理事会记录里面方便的找到改动记录。 + +执行成功后`1 file changed` 一个文件被改动了,也就是我们添加的`readme.txt` + +``` +1 insertions(+)`表示插入了一行内容,我们写的那个`哈哈哈,大家一起来学习git` +``` + +**注意** + +因为在`commit`前需要`add`一下,所以可以一次提交多个文件 + +```bash +C:\Users\simid\Desktop\testrepo>git add file1.txt + +C:\Users\simid\Desktop\testrepo>git add file2.txt + +C:\Users\simid\Desktop\testrepo>git commit -m "two files" +[master 9bcae3f] two files + 2 files changed, 0 insertions(+), 0 deletions(-) + create mode 100644 file1.txt + create mode 100644 file2.txt +``` + +# 回滚操作 + +我们修改上面的文件`readme.txt` + +然后使用`git status`查看 + +```bash +C:\Users\simid\Desktop\testrepo>git status +On branch master +Changes not staged for commit: + (use "git add ..." to update what will be committed) + (use "git restore ..." to discard changes in working directory) + modified: readme.txt + +no changes added to commit (use "git add" and/or "git commit -a") +``` + +`git status`命令可以让我们时刻掌握仓库当前的状态,上面的命令输出告诉我们,`readme.txt`被修改过了,但还没有准备提交的修改。 + +如果想看看具体修改了什么内容,我们可以使用`git diff`来查看 + +```cmd +C:\Users\simid\Desktop\testrepo>git diff +warning: in the working copy of 'readme.txt', CRLF will be replaced by LF the next time Git touches it +diff --git a/readme.txt b/readme.txt +index c237288..d25baa4 100644 +--- a/readme.txt ++++ b/readme.txt +@@ -1 +1,2 @@ +-哈哈哈,大家一起来学习git +\ No newline at end of file ++哈哈哈,大家一起来学习git ++下面准备开始提交代码 +\ No newline at end of file +``` + +可以看到在第一行后面加了一行在下面 + +下面我们将其添加,然后查看`status` + +```cmd +C:\Users\simid\Desktop\testrepo>git add readme.txt +warning: in the working copy of 'readme.txt', CRLF will be replaced by LF the next time Git touches it + +C:\Users\simid\Desktop\testrepo>git status readme.txt +On branch master +Changes to be committed: + (use "git restore --staged ..." to unstage) + modified: readme.txt +``` + +`git status`告诉我们,将要被提交的修改包括`readme.txt`,下一步,就可以放心地提交了 + +```cmd +C:\Users\simid\Desktop\testrepo>git commit -m "change readme.txt" +[master 6ced986] change readme.txt + 1 file changed, 2 insertions(+), 1 deletion(-) +``` + +提交后,我们再用`git status`命令看看仓库的当前状态: + +```cmd +C:\Users\simid\Desktop\testrepo>git status +On branch master +nothing to commit, working tree clean +``` + +Git告诉我们当前没有需要提交的修改,而且,工作目录是干净(working tree clean)的 + +## 版本回退 + +我们创建一个文件叫`game` ,在这个文件中写入以下内容 + +```text +屠龙勇士村来了一个新勇士叫"林克" +``` + +然后提交,提交的说明就是"新的开始" + +[![image-20191026212115336](02.git/image-20191026212115336.png)](https://git.inmind-lab.com/aaronxu/Security-base01/src/branch/main/02.git基础/image-20191026212115336.png) + +在文件中追加内容 + +```text +勇士赤手空拳来到了野外 +``` + +然后提交,提交的说明就是"走出新手村" + +[![image-20191026212310506](02.git/image-20191026212310506.png)](https://git.inmind-lab.com/aaronxu/Security-base01/src/branch/main/02.git基础/image-20191026212310506.png) + +在文件中追加内容 + +```text +勇士林克被Lv1怪物史莱姆一屁股坐死 +``` + +然后提交,提交的说明就是"阵亡" + +[![image-20191026212439959](02.git/image-20191026212439959.png)](https://git.inmind-lab.com/aaronxu/Security-base01/src/branch/main/02.git基础/image-20191026212439959.png) + +在文件中追加内容 + +```text +勇士林克被公主"塞尔达"所救,丢失全部金币! +``` + +然后提交,提交的说明就是"复活" + +[![image-20191026212614476](02.git/image-20191026212614476.png)](https://git.inmind-lab.com/aaronxu/Security-base01/src/branch/main/02.git基础/image-20191026212614476.png) + +下面我们来看下这个悲催的勇士的经历,可以使用`git log`查看历史提交 + +[![image-20191026212755780](02.git/image-20191026212755780.png)](https://git.inmind-lab.com/aaronxu/Security-base01/src/branch/main/02.git基础/image-20191026212755780.png) + +`git log`命令显示从最近到最远的提交日志,我们可以看到3次提交 + +如果嫌输出信息太多,看得眼花缭乱的,可以试试加上`--pretty=oneline`参数 + +[![image-20191026212850868](02.git/image-20191026212850868.png)](https://git.inmind-lab.com/aaronxu/Security-base01/src/branch/main/02.git基础/image-20191026212850868.png) + +其实勇士的悲剧完全可以逆转,我们可以**读档**到`新的开始`,让勇士在出门前带把武器 + +[![image-20191026213156010](02.git/image-20191026213156010.png)](https://git.inmind-lab.com/aaronxu/Security-base01/src/branch/main/02.git基础/image-20191026213156010.png) + +Git的版本回退速度非常快,因为Git在内部有个指向当前版本的`HEAD`指针,当你回退版本的时候,Git仅仅是把HEAD从指向`新的开始`: + +```ascii +┌────┐ +│HEAD│ +└────┘ + │ + └──> ○ 复活 + │ + ○ 阵亡 + │ + ○ 走出新手村 + │ + ○ 新的开始 +``` + +改为指向`add distributed`: + +```ascii +┌────┐ +│HEAD│ +└────┘ + │ + │ ○ 复活 + │ │ + │ ○ 阵亡 + │ │ + │ ○ 走出新手村 + │ │ + └──>○ 新的开始 +``` + +在Git中,用`HEAD`表示当前版本,上一个版本就是`HEAD^`,上上一个版本就是`HEAD^^`,当然往上100个版本写100个`^`比较容易数不过来,所以写成`HEAD~100`。 + +Git提供了一个命令`git reflog`用来记录你的每一次命令: + +## 工作区和暂存区 + +### 工作区 + +就是你在电脑里能看到的目录,比如上面的`gitlearn`文件夹 + +[![image-20191026213858444](02.git/image-20191026213858444.png)](https://git.inmind-lab.com/aaronxu/Security-base01/src/branch/main/02.git基础/image-20191026213858444.png) + +### 版本库 + +工作区有一个隐藏目录`.git`,这个不算工作区,而是Git的版本库。 + +Git的版本库里存了很多东西,其中最重要的就是称为stage(或者叫index)的暂存区,还有Git为我们自动创建的第一个分支`master`,以及指向`master`的一个指针叫`HEAD`。 + +[![image-20191026214144680](02.git/image-20191026214144680.png)](https://git.inmind-lab.com/aaronxu/Security-base01/src/branch/main/02.git基础/image-20191026214144680.png) + +前面讲了我们把文件往Git版本库里添加的时候,是分两步执行的: + +第一步是用`git add`把文件添加进去,实际上就是把文件修改添加到暂存区; + +第二步是用`git commit`提交更改,实际上就是把暂存区的所有内容提交到当前分支。 + +因为我们创建Git版本库时,Git自动为我们创建了唯一一个`master`分支,所以,现在,`git commit`就是往`master`分支上提交更改。 + +你可以简单理解为,需要提交的文件修改通通放到暂存区,然后,一次性提交暂存区的所有修改。 + +## 管理修改 + +git不是管理文件,而是管理修改的操作。 + +我们修改readme.txt,然后add提交到暂存区 + +```cmd +C:\Users\simid\Desktop\testrepo>cat readme.txt +哈哈哈,大家一起来学习git +下面准备开始提交代码 +修改一哈 +C:\Users\simid\Desktop\testrepo>git add readme.txt +warning: in the working copy of 'readme.txt', CRLF will be replaced by LF the next time Git touches it +``` + +然后再次修改readme.txt,这次我们直接commit + +```cmd +C:\Users\simid\Desktop\testrepo>cat readme.txt +哈哈哈,大家一起来学习git +下面准备开始提交代码 +修改一哈 +修改二哈 +C:\Users\simid\Desktop\testrepo>git commit -m "猜猜是一还是二" +[master d716d69] 猜猜是一还是二 + 1 file changed, 2 insertions(+), 1 deletion(-) +``` + +然后查看状态 + +```cmd +C:\Users\simid\Desktop\testrepo>git status +On branch master +Changes not staged for commit: + (use "git add ..." to update what will be committed) + (use "git restore ..." to discard changes in working directory) + modified: readme.txt + +no changes added to commit (use "git add" and/or "git commit -a") +``` + +我们会发现第二次修改的并没有被提交 + +查看一下工作区的文件和仓库的文件的区别 + +```cmd +C:\Users\simid\Desktop\testrepo>git diff head -- readme.txt +warning: in the working copy of 'readme.txt', CRLF will be replaced by LF the next time Git touches it +diff --git a/readme.txt b/readme.txt +index cf326ab..d04489f 100644 +--- a/readme.txt ++++ b/readme.txt +@@ -1,3 +1,4 @@ + 哈哈哈,大家一起来学习git + 下面准备开始提交代码 + 修改一哈 ++修改二哈 +``` + +## 撤销修改 + +- 当你改乱了工作区某个文件的内容,想直接丢弃工作区的修改时,用命令`git checkout -- file`。 +- 当你不但改乱了工作区某个文件的内容,还添加到了暂存区时,想丢弃修改,分两步,第一步用命令`git reset HEAD `,就回到了上一种情况,第二步按上一种情况操作操作。 + +## 删除文件 + +我们将文件从工作区删除 + +[![image-20191026220634410](02.git/image-20191026220634410.png)](https://git.inmind-lab.com/aaronxu/Security-base01/src/branch/main/02.git基础/image-20191026220634410.png) + +git会直接察觉到我们的删除操作,如果这个时候提交,那么就会从版本库中删除该文件 + +[![image-20191026220737779](02.git/image-20191026220737779.png)](https://git.inmind-lab.com/aaronxu/Security-base01/src/branch/main/02.git基础/image-20191026220737779.png) + +但是如果误删除了,可以还原到版本库中的最新版本 + +[![image-20191026220846139](02.git/image-20191026220846139.png)](https://git.inmind-lab.com/aaronxu/Security-base01/src/branch/main/02.git基础/image-20191026220846139.png) + +如果要删除暂存区中的文件,可以使用`git rm` + +# 远程仓库 + +## 注册gitee + +- 官方地址:https://gitee.com/ + +- 注册过程:==略== + +## 配置密钥 + +- 打开命令行,创建用于登录gitee仓库的key + +```cmd +C:\Users\simid\Desktop\testrepo>ssh-keygen -t rsa -C "simidaxu@gmail.com" +Generating public/private rsa key pair. +Enter file in which to save the key (C:\Users\simid/.ssh/id_rsa): <-- 注意,这里直接回车 +Enter passphrase (empty for no passphrase): <-- 注意,这里直接回车 +Enter same passphrase again: <-- 注意,这里直接回车 +Your identification has been saved in C:\Users\simid/.ssh/id_rsa +Your public key has been saved in C:\Users\simid/.ssh/id_rsa.pub <-- 注意这个是密钥位置 +The key fingerprint is: +SHA256:MlHuxb1mUBUHCxDtNljwtAT2nqN4C9AjhCjnpGO+068 simidaxu@gmail.com +The key's randomart image is: ++---[RSA 3072]----+ +| . **=.+o.| +| . . o o Boo o | +|. + . o . ++= . | +| * . + ..o+o | +|o.. = S .B. | +|o. = o + . | +| .. o o | +| ... o . | +| ..Eo. . | ++----[SHA256]-----+ +``` + +- 打开gitee账号设置 + +![image-20251106162201573](02.git/image-20251106162201573.png) + +- 打开ssh公钥 + +![image-20251106162235508](02.git/image-20251106162235508.png) + +- 随便起个标题,建议和当前的设备挂钩,这样方便后续管理各个设备是否可以登录 +- 公钥就直接粘贴上面生成的文件里面的内容,使用`cat 上面公钥的位置` 命令可以查看 + +![image-20251106162431939](02.git/image-20251106162431939.png) + +- 添加成功后 + +![image-20251106162530872](02.git/image-20251106162530872.png) + +- 测试能否连接成功! + +```cmd +C:\Users\simid\Desktop\testrepo>ssh -T git@gitee.com +The authenticity of host 'gitee.com (180.76.198.225)' can't be established. +ED25519 key fingerprint is SHA256:+ULzij2u99B9eWYFTw1Q4ErYG/aepHLbu96PAUCoV88. +This key is not known by any other names. +Are you sure you want to continue connecting (yes/no/[fingerprint])? yes <-- 此处输入yes +Warning: Permanently added 'gitee.com' (ED25519) to the list of known hosts. +Hi AaronXu(@hiaaron)! You've successfully authenticated, but GITEE.COM does not provide shell access. +``` + +## 添加远程仓库 + +- 点击新建仓库 + +![image-20251106163038203](02.git/image-20251106163038203.png) + +- 填写名称和描述 + +![image-20251106163204796](02.git/image-20251106163204796.png) + +- 创建成功之后,按照仓库给出的入门教程,可以将已有的仓库同步上来 + +![image-20251106163301152](02.git/image-20251106163301152.png) + +- 开始操作,中途第一次会弹出来输入gitee的用户名和密码,之后就不会有了 + +```cmd +C:\Users\simid\Desktop\testrepo>git config --global user.name "AaronXu" + +C:\Users\simid\Desktop\testrepo>git config --global user.email "718827633@qq.com" + +C:\Users\simid\Desktop\testrepo>git remote add origin https://gitee.com/hiaaron/testrepo.git + +C:\Users\simid\Desktop\testrepo>git push -u origin "master" +remote: [session-104850bf] hiaaron: Incorrect username or password (access token) +fatal: Authentication failed for 'https://gitee.com/hiaaron/testrepo.git/' + +C:\Users\simid\Desktop\testrepo>git push -u origin "master" +Enumerating objects: 12, done. +Counting objects: 100% (12/12), done. +Delta compression using up to 16 threads +Compressing objects: 100% (9/9), done. +Writing objects: 100% (12/12), 997 bytes | 332.00 KiB/s, done. +Total 12 (delta 3), reused 0 (delta 0), pack-reused 0 (from 0) +remote: Powered by GITEE.COM [1.1.5] +remote: Set trace flag c24dfd94 +To https://gitee.com/hiaaron/testrepo.git + * [new branch] master -> master +branch 'master' set up to track 'origin/master'. +``` + +- 代码提交成功 + +![image-20251106163525799](02.git/image-20251106163525799.png) + +## 仓库使用 + +- 一些常用的操作 + +![image-20251106163627958](02.git/image-20251106163627958.png) \ No newline at end of file diff --git a/02.git/image-20191026212115336.png b/02.git/image-20191026212115336.png new file mode 100644 index 0000000..cee6c17 Binary files /dev/null and b/02.git/image-20191026212115336.png differ diff --git a/02.git/image-20191026212310506.png b/02.git/image-20191026212310506.png new file mode 100644 index 0000000..e21aa0f Binary files /dev/null and b/02.git/image-20191026212310506.png differ diff --git a/02.git/image-20191026212439959.png b/02.git/image-20191026212439959.png new file mode 100644 index 0000000..b7576ac Binary files /dev/null and b/02.git/image-20191026212439959.png differ diff --git a/02.git/image-20191026212614476.png b/02.git/image-20191026212614476.png new file mode 100644 index 0000000..b4b21b3 Binary files /dev/null and b/02.git/image-20191026212614476.png differ diff --git a/02.git/image-20191026212755780.png b/02.git/image-20191026212755780.png new file mode 100644 index 0000000..6752e49 Binary files /dev/null and b/02.git/image-20191026212755780.png differ diff --git a/02.git/image-20191026212850868.png b/02.git/image-20191026212850868.png new file mode 100644 index 0000000..a20ffa2 Binary files /dev/null and b/02.git/image-20191026212850868.png differ diff --git a/02.git/image-20191026213156010.png b/02.git/image-20191026213156010.png new file mode 100644 index 0000000..cb162ec Binary files /dev/null and b/02.git/image-20191026213156010.png differ diff --git a/02.git/image-20191026213858444.png b/02.git/image-20191026213858444.png new file mode 100644 index 0000000..b8c5941 Binary files /dev/null and b/02.git/image-20191026213858444.png differ diff --git a/02.git/image-20191026214144680.png b/02.git/image-20191026214144680.png new file mode 100644 index 0000000..2a17fac Binary files /dev/null and b/02.git/image-20191026214144680.png differ diff --git a/02.git/image-20191026220634410.png b/02.git/image-20191026220634410.png new file mode 100644 index 0000000..2ac94bc Binary files /dev/null and b/02.git/image-20191026220634410.png differ diff --git a/02.git/image-20191026220737779.png b/02.git/image-20191026220737779.png new file mode 100644 index 0000000..d953b8c Binary files /dev/null and b/02.git/image-20191026220737779.png differ diff --git a/02.git/image-20191026220846139.png b/02.git/image-20191026220846139.png new file mode 100644 index 0000000..996247b Binary files /dev/null and b/02.git/image-20191026220846139.png differ diff --git a/02.git/image-20251106162201573.png b/02.git/image-20251106162201573.png new file mode 100644 index 0000000..5f677d3 Binary files /dev/null and b/02.git/image-20251106162201573.png differ diff --git a/02.git/image-20251106162235508.png b/02.git/image-20251106162235508.png new file mode 100644 index 0000000..782bf44 Binary files /dev/null and b/02.git/image-20251106162235508.png differ diff --git a/02.git/image-20251106162431939.png b/02.git/image-20251106162431939.png new file mode 100644 index 0000000..76b7b7d Binary files /dev/null and b/02.git/image-20251106162431939.png differ diff --git a/02.git/image-20251106162530872.png b/02.git/image-20251106162530872.png new file mode 100644 index 0000000..6c1d984 Binary files /dev/null and b/02.git/image-20251106162530872.png differ diff --git a/02.git/image-20251106163038203.png b/02.git/image-20251106163038203.png new file mode 100644 index 0000000..aa85e3a Binary files /dev/null and b/02.git/image-20251106163038203.png differ diff --git a/02.git/image-20251106163204796.png b/02.git/image-20251106163204796.png new file mode 100644 index 0000000..b7abac3 Binary files /dev/null and b/02.git/image-20251106163204796.png differ diff --git a/02.git/image-20251106163301152.png b/02.git/image-20251106163301152.png new file mode 100644 index 0000000..6fd4cc2 Binary files /dev/null and b/02.git/image-20251106163301152.png differ diff --git a/02.git/image-20251106163525799.png b/02.git/image-20251106163525799.png new file mode 100644 index 0000000..9461a62 Binary files /dev/null and b/02.git/image-20251106163525799.png differ diff --git a/02.git/image-20251106163627958.png b/02.git/image-20251106163627958.png new file mode 100644 index 0000000..ab45bf5 Binary files /dev/null and b/02.git/image-20251106163627958.png differ diff --git a/README.md b/README.md new file mode 100644 index 0000000..e91b353 --- /dev/null +++ b/README.md @@ -0,0 +1 @@ +学习如何使用Markdown记录笔记 \ No newline at end of file diff --git a/Typora.zip b/Typora.zip new file mode 100644 index 0000000..ffb6647 Binary files /dev/null and b/Typora.zip differ