Compare commits
2
Commits
e4c08e4b0a
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2865b12ed9 | ||
|
|
c2459db584 |
@@ -0,0 +1,17 @@
|
||||
---
|
||||
{
|
||||
title: "近期开发记录",
|
||||
draft: false,
|
||||
type: "rambling",
|
||||
created_at: "2025-10-26T01:32:16+08:00",
|
||||
published_at: "2025-10-26T01:32:16+08:00",
|
||||
updated_at: [ "2025-10-26T01:32:16+08:00"],
|
||||
}
|
||||
---
|
||||
感觉有点命苦,接下来我梦到哪说哪
|
||||
大四本是没什么课的时候,尤其是大四上。
|
||||
但是最近恰逢两门课程结课,碰上团队招新,加研0学习任务。搞得时间很紧。
|
||||
今天周六,做了一天的嵌入式大作业,唉,avalonia真无敌了,能参考的资料有点少,debug全靠AI。
|
||||
晚上测试时发现RK3588跑Ollama跑在了CPU上,现在还在下模型 + 做量化。
|
||||
今天舍友玩了一天,现在美美睡了,我还在写报告。
|
||||
反正就是命苦。
|
||||
@@ -0,0 +1,48 @@
|
||||
---
|
||||
{
|
||||
title: "不使用git reset 恢复误删除的 submodule",
|
||||
description: "这篇文章介绍了两种恢复误删除 Git Submodule 的方法:一种是使用 git reset 的简单方案,另一种是不使用 reset 的详细手动恢复步骤,帮助你在不改变提交历史的情况下修复子模块。",
|
||||
draft: false,
|
||||
type: "article",
|
||||
created_at: "2025-11-16T16:34:11+08:00",
|
||||
published_at: "2025-11-16T16:48:20+08:00",
|
||||
updated_at: [ "2025-11-16T16:48:20+08:00" ],
|
||||
category: '开发',
|
||||
tags: [ "Git" ],
|
||||
tech_stack: [ "Git" ],
|
||||
tech_stack_percent: [ 1 ],
|
||||
tech_stack_icon_names: [ "mdi:git" ],
|
||||
tech_stack_theme_colors: [ "#f65f3d" ],
|
||||
}
|
||||
---
|
||||
## 如果你可以使用Git Reset
|
||||
如果你可以使用 `git reset`,那么恢复误删除的 Git Submodule 非常简单:
|
||||
|
||||
```bash
|
||||
git reset --hard HEAD
|
||||
git submodule update --init --recursive
|
||||
```
|
||||
## 如果不能使用Git Reset
|
||||
如果你不能使用 `git reset`,只想重新checkout误删除的Git Submodule,可以使用以下方法:
|
||||
这里,我使用example作为submodule名字和路径,`.gitmodules` 配置如下:
|
||||
|
||||
```
|
||||
[submodule "example"]
|
||||
path = example
|
||||
url = https://github.com/example/example
|
||||
```
|
||||
使用以下命令:
|
||||
```bash
|
||||
git ls-tree HEAD example
|
||||
```
|
||||
能得到类似如下结果:
|
||||
```
|
||||
160000 commit c2459db584158403a05821f8a56327b9936cdbe1 example
|
||||
```
|
||||
据此,执行以下命令恢复目标submodule:
|
||||
```bash
|
||||
git update-index --add --cacheinfo 160000,c2459db584158403a05821f8a56327b9936cdbe1,example
|
||||
git submodule sync --recursive
|
||||
git submodule update --init --recursive example
|
||||
```
|
||||
这种恢复方法相较于重新执行git submodule add命令,不会出现新的submodule commit ID。
|
||||
Reference in New Issue
Block a user