mirror of
https://github.com/Dichgrem/Blog.git
synced 2025-12-16 21:42:00 -05:00
update:git
This commit is contained in:
@@ -313,6 +313,44 @@
|
||||
<p>如果你的远程仓库是最新的,可以使用以下命令更新本地仓库:</p>
|
||||
<pre style="background-color:#151515;color:#e8e8d3;"><code><span>git pull
|
||||
</span></code></pre>
|
||||
<blockquote>
|
||||
<p>Verified</p>
|
||||
</blockquote>
|
||||
<p>在 GitHub 的 commit 历史中看到的 “Verified” 标记,表示该提交是经过 签名验证(signed commit) 的,也就是 GitHub 能确认这个 commit 的确是由声明的提交者(你)签名并发布的。可以通过GPG或者SSH配置:</p>
|
||||
<ul>
|
||||
<li>GPG方式</li>
|
||||
</ul>
|
||||
<pre style="background-color:#151515;color:#e8e8d3;"><code><span>sudo pacman -S gnupg //安装 GPG
|
||||
</span><span>gpg --full-generate-key //生成 GPG 密钥
|
||||
</span><span>gpg --list-secret-keys --keyid-format=long //查看你生成的密钥 ID
|
||||
</span><span>git config --global user.signingkey ABCDEF1234567890 //让 Git 使用该密钥签名
|
||||
</span><span>git config --global commit.gpgsign true //启用自动签名所有提交
|
||||
</span><span>gpg --armor --export ABCDEF1234567890 //导出公钥并添加到 GitHub
|
||||
</span></code></pre>
|
||||
<p>然后前往<code>GitHub → Settings → SSH and GPG keys → New GPG key</code>粘贴并保存。</p>
|
||||
<ul>
|
||||
<li>SSH方式</li>
|
||||
</ul>
|
||||
<p>可以用你平时登录 GitHub 的同一个 SSH 密钥:</p>
|
||||
<pre style="background-color:#151515;color:#e8e8d3;"><code><span>git config --global gpg.format ssh //让 Git 使用 SSH 格式签名
|
||||
</span><span>git config --global user.signingkey ~/.ssh/Github.pub //指定使用的 SSH 公钥
|
||||
</span><span>git config --global commit.gpgsign true //表示自动签名所有提交
|
||||
</span></code></pre>
|
||||
<p>然后前往<code>Settings → SSH and GPG keys → New SSH key → Signing key</code>粘贴并保存。</p>
|
||||
<ul>
|
||||
<li>本地查看</li>
|
||||
</ul>
|
||||
<p>首先创建这个文件:</p>
|
||||
<pre style="background-color:#151515;color:#e8e8d3;"><code><span>mkdir -p ~/.ssh
|
||||
</span><span>nano ~/.ssh/allowed_signers
|
||||
</span></code></pre>
|
||||
<p>写入你的 <code>test@mail.com ssh-ed25519 AAAABBBBBBBBBBBBBBBBxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx</code>并保存。
|
||||
随后配置Git信任该文件:</p>
|
||||
<pre style="background-color:#151515;color:#e8e8d3;"><code><span>git config --global gpg.ssh.allowedSignersFile ~/.ssh/allowed_signers
|
||||
</span></code></pre>
|
||||
<p>随后使用<code>git log --show-signature</code>即可查看本地log中的</p>
|
||||
<pre style="background-color:#151515;color:#e8e8d3;"><code><span>Good "git" signature for test@mail.com with ED25519 key SHA256:ssh-ed25519 AAAABBBBBBBBBBBBBBBBBBBBB
|
||||
</span></code></pre>
|
||||
<h2 id="he-bing-fen-zhi">合并分支</h2>
|
||||
<p>分支是用来将特性开发绝缘开来的。比如你在本地的test分支新增了一个功能,想要合并到主分支中。</p>
|
||||
<p>创建一个叫做“test”的分支,并切换过去:</p>
|
||||
@@ -483,6 +521,13 @@
|
||||
</ul>
|
||||
<pre style="background-color:#151515;color:#e8e8d3;"><code><span>git log --name-status
|
||||
</span></code></pre>
|
||||
<h2 id="sheng-cheng-bu-ding">生成补丁</h2>
|
||||
<p>比如你修改了项目中的<code>fs/proc/base.c</code>,然后</p>
|
||||
<pre style="background-color:#151515;color:#e8e8d3;"><code><span>git add fs/proc/base.c
|
||||
</span><span>git commit -m "fix:base"
|
||||
</span><span>git format-patch origin/16.0
|
||||
</span></code></pre>
|
||||
<p>即可在目录下生成补丁<code>0001-fix-base.patch</code>.</p>
|
||||
<h2 id="shan-chu-qian-yi-ge-ti-jiao-ji-lu">删除前一个提交记录</h2>
|
||||
<p>有时候手滑或者不想使用一个commit说明,可以用以下命令撤销上一个 commit:</p>
|
||||
<pre style="background-color:#151515;color:#e8e8d3;"><code><span>git reset --soft HEAD~1
|
||||
|
||||
@@ -441,9 +441,7 @@
|
||||
</span></code></pre>
|
||||
<h2 id="geng-huan-xi-tong">更换系统</h2>
|
||||
<p>除了到VPS后台更换外,还可以使用这个脚本:</p>
|
||||
<ul>
|
||||
<li><a href="https://blog.dich.bid/about-server-set/github.com/bin456789/reinstall">bin456789/reinstall</a></li>
|
||||
</ul>
|
||||
<p><a href="https://blog.dich.bid/about-server-set/github.com/bin456789/reinstall">bin456789/reinstall</a></p>
|
||||
<pre style="background-color:#151515;color:#e8e8d3;"><code><span>一键重装到 Linux,支持 19 种常见发行版
|
||||
</span><span>一键重装到 Windows,使用官方原版 ISO 而非自制镜像,脚本支持自动查找 ISO 链接、自动安装 VirtIO 等公有云驱动
|
||||
</span><span>支持任意方向重装,即 Linux to Linux、Linux to Windows、Windows to Windows、Windows to Linux
|
||||
|
||||
Binary file not shown.
BIN
public/pagefind/fragment/en_ad4c715.pf_fragment
Normal file
BIN
public/pagefind/fragment/en_ad4c715.pf_fragment
Normal file
Binary file not shown.
BIN
public/pagefind/index/en_2b9cf43.pf_index
Normal file
BIN
public/pagefind/index/en_2b9cf43.pf_index
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
public/pagefind/index/en_8e11b0e.pf_index
Normal file
BIN
public/pagefind/index/en_8e11b0e.pf_index
Normal file
Binary file not shown.
BIN
public/pagefind/index/en_903572b.pf_index
Normal file
BIN
public/pagefind/index/en_903572b.pf_index
Normal file
Binary file not shown.
BIN
public/pagefind/index/en_d9025a4.pf_index
Normal file
BIN
public/pagefind/index/en_d9025a4.pf_index
Normal file
Binary file not shown.
Binary file not shown.
BIN
public/pagefind/index/en_e930797.pf_index
Normal file
BIN
public/pagefind/index/en_e930797.pf_index
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1 +1 @@
|
||||
{"version":"1.3.0","languages":{"en":{"hash":"en_1515ccaa8c","wasm":"en","page_count":77}}}
|
||||
{"version":"1.3.0","languages":{"en":{"hash":"en_40173c68cb","wasm":"en","page_count":77}}}
|
||||
Binary file not shown.
BIN
public/pagefind/pagefind.en_40173c68cb.pf_meta
Normal file
BIN
public/pagefind/pagefind.en_40173c68cb.pf_meta
Normal file
Binary file not shown.
Reference in New Issue
Block a user