From fa81356ad353e0e55db1c7c39067c063e2ba4954 Mon Sep 17 00:00:00 2001 From: qhan Date: Fri, 10 May 2024 10:29:51 +0800 Subject: [PATCH] feat(site/blog): add article of git commands --- .../app/(web)/posts/[slug]/MDXContent.tsx | 2 +- site/blog/app/(web)/posts/[slug]/styles.scss | 6 +-- site/blog/md/posts/git-common-commands.md | 43 +++++++++++++++++++ 3 files changed, 46 insertions(+), 5 deletions(-) create mode 100644 site/blog/md/posts/git-common-commands.md diff --git a/site/blog/app/(web)/posts/[slug]/MDXContent.tsx b/site/blog/app/(web)/posts/[slug]/MDXContent.tsx index 93e833f..623abc0 100644 --- a/site/blog/app/(web)/posts/[slug]/MDXContent.tsx +++ b/site/blog/app/(web)/posts/[slug]/MDXContent.tsx @@ -27,7 +27,7 @@ const options: MDXRemoteProps["options"] = { rehypeSlug, rehypeAutolinkHeadings, // @ts-ignore - [rehypeShiki, { theme: "nord" }], + [rehypeShiki, { theme: "vitesse-light" }], ], }, }; diff --git a/site/blog/app/(web)/posts/[slug]/styles.scss b/site/blog/app/(web)/posts/[slug]/styles.scss index f1c795f..333fd2e 100644 --- a/site/blog/app/(web)/posts/[slug]/styles.scss +++ b/site/blog/app/(web)/posts/[slug]/styles.scss @@ -40,13 +40,11 @@ } } -.prose pre.shiki.nord { +.prose pre.shiki.vitesse-light { font-family: DM Mono, Input Mono, Fira Code, monospace; font-size: 0.92em; line-height: 1.4; // margin: 0.5em 0; - code { - color: inherit; - } + background-color: #f9f9f9 !important; } diff --git a/site/blog/md/posts/git-common-commands.md b/site/blog/md/posts/git-common-commands.md new file mode 100644 index 0000000..caff40a --- /dev/null +++ b/site/blog/md/posts/git-common-commands.md @@ -0,0 +1,43 @@ +--- +title: 常用GIT操作命令 +date: 2024-05-10T20:08:56+08:00 +category: git +tags: [git, bash] +description: 收集并整理日常工作中频繁用到的一些git操作命令。 +--- + +- 合并分支 +```bash +# 先切到需要合并到的分支 +git checkout target-branch-name +git merge --no-ff feature/branch-name +``` + +- 查看提交记录 +```bash +# 查看分支记录 +git reflog + +# 图形查看分支记录 +git reflog --graph +``` + +- 同步远程分支 +```bash +# 同步远程分支 +git remote prune origin +``` +- 获取远程分支 +```bash +# 获取远程分支推送(-a 为全部推送) +git fetch -a + +# 弃本地所有修改同步最新的远端代码 +git fetch --all +git reset --hard origin/main #这里 main 为对应的分支名 +git pull + +# or +# git pull --force <远程主机名> <远程分支名>:<本地分支名> +git pull --force origin main:main +```