diff --git a/src/app/globals.css b/src/app/globals.css index bd2be60..4228ced 100644 --- a/src/app/globals.css +++ b/src/app/globals.css @@ -78,7 +78,7 @@ a { box-shadow: 0 0 26px rgba(34, 211, 238, 0.42); } -.tech-doc-content :where(h3, h4) { +.tech-doc-content :where(h3, h4, h5) { margin: 42px 0 16px; scroll-margin-top: 32px; color: #ffffff; @@ -100,6 +100,12 @@ a { color: #a5f3fc; } +.tech-doc-content h5 { + margin-top: 28px; + color: #e9d5ff; + font-size: 0.98rem; +} + .tech-doc-content :where(p, ul, ol, blockquote, pre) { margin: 16px 0; } @@ -227,6 +233,37 @@ a { white-space: pre; } +.tech-doc-content table { + display: block; + width: 100%; + max-width: 100%; + margin: 22px 0; + overflow-x: auto; + border: 1px solid rgba(103, 232, 249, 0.2); + border-radius: 16px; + border-spacing: 0; + background: rgba(2, 6, 23, 0.42); + box-shadow: 0 16px 42px rgba(2, 6, 23, 0.22); +} + +.tech-doc-content :where(th, td) { + border-bottom: 1px solid rgba(255, 255, 255, 0.08); + border-right: 1px solid rgba(255, 255, 255, 0.08); + padding: 0.85rem 1rem; + text-align: left; + vertical-align: top; +} + +.tech-doc-content th { + background: rgba(34, 211, 238, 0.11); + color: #cffafe; + font-weight: 900; +} + +.tech-doc-content td { + color: rgba(255, 255, 255, 0.72); +} + .tech-doc-content img { width: 100%; max-width: 100%; diff --git a/src/components/frontend-notes-page.tsx b/src/components/frontend-notes-page.tsx index a53ad9d..c42071c 100644 --- a/src/components/frontend-notes-page.tsx +++ b/src/components/frontend-notes-page.tsx @@ -6,6 +6,7 @@ import { Braces, Code2, Gauge, + GitBranch, Globe2, Layers3, MonitorCog, @@ -113,6 +114,12 @@ const articleVisuals: Record< track: "Execution", Icon: Braces, }, + git: { + accent: "from-orange-200 via-rose-300 to-cyan-300", + glyph: "Git", + track: "Version control", + Icon: GitBranch, + }, }; const featuredSlugs = ["javascript-part-1", "css", "browser"] as const; diff --git a/src/content/notes/frontend/articles.ts b/src/content/notes/frontend/articles.ts index 2f9965d..6d9136b 100644 --- a/src/content/notes/frontend/articles.ts +++ b/src/content/notes/frontend/articles.ts @@ -71,6 +71,12 @@ export const frontendArticles = [ description: "异步编程、事件循环、作用域、this、类型转换等代码输出题整理。", file: "code-output.html", }, + { + slug: "git", + title: "Git 高频知识点", + description: "Git 基础、提交流程、分支、stash、远程协作、SSH 和忽略清单等知识点整理。", + file: "git.html", + }, ] as const; export function getFrontendArticle(slug: string) { diff --git a/src/content/notes/frontend/git.html b/src/content/notes/frontend/git.html new file mode 100644 index 0000000..402bbd9 --- /dev/null +++ b/src/content/notes/frontend/git.html @@ -0,0 +1,136 @@ +
版本管理是一种记录文件变化的方式,以便将来查阅特定版本的文件内容。
+Git 是一个版本管理控制系统(VCS),它可以在任何时间点,将文档的状态作为更新记录保存起来,也可以在任何时间点,将更新记录恢复回来。
+在安装过程中,所有选项使用默认值即可。
+| Git 仓库 | 暂存区 | 工作目录 |
|---|---|---|
| 用于存放提交记录 | 临时存放被修改文件 | 被 Git 管理的项目目录 |
在使用 Git 前,需要告诉 Git 你是谁,在向 Git 仓库中提交时需要用到。
+git config --global user.name 提交人姓名git config --global user.email 提交人邮箱git config --list注意:
+git init 初始化 Git 仓库。git status 查看文件状态。git add 文件列表 追踪文件。git commit -m 提交信息 向仓库中提交代码。git log 查看提交记录。git checkout 文件git rm --cached 文件git reset --hard commitID为了便于理解,可以暂时认为分支就是当前工作目录中代码的一份副本。
+使用分支,可以让我们从开发主线上分离出来,以免影响开发主线。
+功能分支 -> 开发分支 -> 主分支
+git branch 查看分支。git branch 分支名称 创建分支。git checkout 分支名称 切换分支。git checkout -b 分支名称 origin/分支名称 创建并切换分支,同时基于远程分支拉取代码。git merge 来源分支 合并分支。git branch -d 分支名称 删除分支,分支被合并后才允许删除;-D 表示强制删除。在 Git 中,可以暂时提取分支上所有的改动并存储,让开发人员得到一个干净的工作副本,临时转向其他工作。
+使用场景:分支临时切换。
+git stashgit stash pop在版本控制系统中,大约 90% 的操作都是在本地仓库中进行的:暂存、提交、查看状态或历史记录等。除此之外,如果仅仅只有你一个人在这个项目里工作,你永远没有机会需要设置一个远程仓库。
+只有当你需要和开发团队共享数据时,设置一个远程仓库才有意义。你可以把它想象成一个“文件管理服务器”,利用这个服务器可以与开发团队的其他成员进行数据交换。
+git push 远程仓库地址 分支名称git push 远程仓库地址别名 分支名称git push -u 远程仓库地址别名 分支名称:-u 会记住推送地址及分支,下次推送只需要输入 git push。git remote add 远程仓库地址别名 远程仓库地址克隆远端数据仓库到本地:git clone 仓库地址
拉取远程仓库中最新的版本:git pull 远程仓库地址 分支名称
在多人同时开发一个项目时,如果两个人修改了同一个文件的同一个地方,就会发生冲突。冲突需要人为解决。
+HTTPS 协议仓库地址:https://github.com/itcast-frontEnd/git-demo.git
生成密钥:ssh-keygen
密钥存储目录:C:\Users\用户\.ssh
公钥名称:id_rsa.pub
私钥名称:id_rsa
将不需要被 Git 管理的文件名字添加到忽略清单中,在执行 Git 命令的时候,Git 就会忽略这些文件。
+Git 忽略清单文件名称:.gitignore
+将工作目录中的文件全部添加到暂存区:git add .