chore: 导入旧记忆备份供恢复
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
---
|
||||
title: 坑:Windows 目录改名被句柄锁死的破解法(句柄跟对象走)
|
||||
type: experience
|
||||
permalink: main/projects/d5a7f581-c442-4554-87b9-ee723b8b0258/坑-windows-目录改名被句柄锁死的破解法句柄跟对象走
|
||||
stable_id: bc21af00-1127-44f8-93b7-aa484a7041c2
|
||||
scope: project
|
||||
memory_type: experience
|
||||
project_id: d5a7f581-c442-4554-87b9-ee723b8b0258
|
||||
usage_profile_id: 7aee455b-24cc-4008-bdaf-443721e6f939
|
||||
status: active
|
||||
revision: 1
|
||||
request_id: metrix-plugins-e7
|
||||
created_at: '2026-08-17T02:04:28.874467+00:00'
|
||||
updated_at: '2026-08-17T02:04:28.874467+00:00'
|
||||
tags:
|
||||
- pitfall
|
||||
- windows
|
||||
- git
|
||||
- submodule
|
||||
---
|
||||
|
||||
现象:git mv 子模块目录报 Permission denied,Windows 下目录树内只要有任何打开的句柄,整树 rename 就会失败(与句柄共享模式无关)。本例是 Cursor IDE 持有子模块内嵌 .git 的目录句柄(.git、refs/remotes/origin)和 pack/idx 文件内存映射。排查:逐层 Rename-Item 二分定位被锁子项;用 Sysinternals handle64.exe(live.sysinternals.com 临时下载,用完删)查持锁进程。破解(无需重启 IDE/杀进程):Windows 句柄跟随对象而非路径,且单个被打开对象若共享 DELETE 可直接 Move-Item——把被锁对象逐个移出目录树(移到 temp),树内无句柄后整树 rename 成功,再把对象移回新位置;全程可逆。另:手动迁移子模块(非 git mv)后需补:.gitmodules 改 path(先 git add .gitmodules 否则 git rm 报 stage 错误)→ git rm --cached 旧路径 → git add 新路径(含 .git 的目录自动成 gitlink,embedded 警告可忽略)→ git submodule sync;内嵌 .git 自包含无需改指针,absorbed 子模块用 git mv 会自动处理。
|
||||
Reference in New Issue
Block a user