mirror of
https://github.com/Dichgrem/Blog.git
synced 2025-12-16 13:32:00 -05:00
update:git
This commit is contained in:
@@ -201,6 +201,50 @@ git push origin main
|
||||
```
|
||||
git pull
|
||||
```
|
||||
|
||||
> Verified
|
||||
|
||||
在 GitHub 的 commit 历史中看到的 “Verified” 标记,表示该提交是经过 签名验证(signed commit) 的,也就是 GitHub 能确认这个 commit 的确是由声明的提交者(你)签名并发布的。可以通过GPG或者SSH配置:
|
||||
|
||||
- GPG方式
|
||||
|
||||
```
|
||||
sudo pacman -S gnupg //安装 GPG
|
||||
gpg --full-generate-key //生成 GPG 密钥
|
||||
gpg --list-secret-keys --keyid-format=long //查看你生成的密钥 ID
|
||||
git config --global user.signingkey ABCDEF1234567890 //让 Git 使用该密钥签名
|
||||
git config --global commit.gpgsign true //启用自动签名所有提交
|
||||
gpg --armor --export ABCDEF1234567890 //导出公钥并添加到 GitHub
|
||||
```
|
||||
然后前往``GitHub → Settings → SSH and GPG keys → New GPG key``粘贴并保存。
|
||||
|
||||
- SSH方式
|
||||
|
||||
可以用你平时登录 GitHub 的同一个 SSH 密钥:
|
||||
```
|
||||
git config --global gpg.format ssh //让 Git 使用 SSH 格式签名
|
||||
git config --global user.signingkey ~/.ssh/Github.pub //指定使用的 SSH 公钥
|
||||
git config --global commit.gpgsign true //表示自动签名所有提交
|
||||
```
|
||||
然后前往``Settings → SSH and GPG keys → New SSH key → Signing key``粘贴并保存。
|
||||
|
||||
- 本地查看
|
||||
|
||||
首先创建这个文件:
|
||||
```
|
||||
mkdir -p ~/.ssh
|
||||
nano ~/.ssh/allowed_signers
|
||||
```
|
||||
写入你的 ``test@mail.com ssh-ed25519 AAAABBBBBBBBBBBBBBBBxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx``并保存。
|
||||
随后配置Git信任该文件:
|
||||
```
|
||||
git config --global gpg.ssh.allowedSignersFile ~/.ssh/allowed_signers
|
||||
```
|
||||
随后使用``git log --show-signature``即可查看本地log中的
|
||||
```
|
||||
Good "git" signature for test@mail.com with ED25519 key SHA256:ssh-ed25519 AAAABBBBBBBBBBBBBBBBBBBBB
|
||||
```
|
||||
|
||||
## 合并分支
|
||||
|
||||
分支是用来将特性开发绝缘开来的。比如你在本地的test分支新增了一个功能,想要合并到主分支中。
|
||||
@@ -378,6 +422,16 @@ git log --pretty=oneline
|
||||
```
|
||||
git log --name-status
|
||||
```
|
||||
## 生成补丁
|
||||
|
||||
比如你修改了项目中的``fs/proc/base.c``,然后
|
||||
|
||||
```
|
||||
git add fs/proc/base.c
|
||||
git commit -m "fix:base"
|
||||
git format-patch origin/16.0
|
||||
```
|
||||
即可在目录下生成补丁``0001-fix-base.patch``.
|
||||
|
||||
## 删除前一个提交记录
|
||||
有时候手滑或者不想使用一个commit说明,可以用以下命令撤销上一个 commit:
|
||||
|
||||
@@ -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
|
||||
|
||||
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_39e5240.pf_index
Normal file
BIN
public/pagefind/index/en_39e5240.pf_index
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
public/pagefind/index/en_857bb10.pf_index
Normal file
BIN
public/pagefind/index/en_857bb10.pf_index
Normal file
Binary file not shown.
BIN
public/pagefind/index/en_9df17a3.pf_index
Normal file
BIN
public/pagefind/index/en_9df17a3.pf_index
Normal file
Binary file not shown.
BIN
public/pagefind/index/en_af5f91d.pf_index
Normal file
BIN
public/pagefind/index/en_af5f91d.pf_index
Normal file
Binary file not shown.
BIN
public/pagefind/index/en_cee394a.pf_index
Normal file
BIN
public/pagefind/index/en_cee394a.pf_index
Normal file
Binary file not shown.
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_1db5ef9be9","wasm":"en","page_count":77}}}
|
||||
Binary file not shown.
BIN
public/pagefind/pagefind.en_1db5ef9be9.pf_meta
Normal file
BIN
public/pagefind/pagefind.en_1db5ef9be9.pf_meta
Normal file
Binary file not shown.
Reference in New Issue
Block a user