惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

WordPress大学
WordPress大学
Microsoft Security Blog
Microsoft Security Blog
Security Archives - TechRepublic
Security Archives - TechRepublic
V
Visual Studio Blog
宝玉的分享
宝玉的分享
IT之家
IT之家
人人都是产品经理
人人都是产品经理
T
The Blog of Author Tim Ferriss
I
InfoQ
B
Blog RSS Feed
T
Threatpost
博客园_首页
M
MIT News - Artificial intelligence
Spread Privacy
Spread Privacy
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Know Your Adversary
Know Your Adversary
U
Unit 42
Engineering at Meta
Engineering at Meta
C
Cyber Attacks, Cyber Crime and Cyber Security
月光博客
月光博客
Scott Helme
Scott Helme
T
Tor Project blog
有赞技术团队
有赞技术团队
AWS News Blog
AWS News Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
Last Week in AI
Last Week in AI
S
Schneier on Security
Vercel News
Vercel News
博客园 - Franky
C
Cybersecurity and Infrastructure Security Agency CISA
L
LINUX DO - 热门话题
NISL@THU
NISL@THU
L
LangChain Blog
爱范儿
爱范儿
Google DeepMind News
Google DeepMind News
The GitHub Blog
The GitHub Blog
雷峰网
雷峰网
Latest news
Latest news
C
CXSECURITY Database RSS Feed - CXSecurity.com
Hugging Face - Blog
Hugging Face - Blog
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
www.infosecurity-magazine.com
www.infosecurity-magazine.com
G
GRAHAM CLULEY
S
Security Affairs
A
About on SuperTechFans
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
大猫的无限游戏
大猫的无限游戏
W
WeLiveSecurity
Cisco Talos Blog
Cisco Talos Blog
罗磊的独立博客

7gugu's Blog

小米摄像头4 4K版接入Homekit分享 – 7gugu's Blog 【日常碎碎念】AI取代前端? – 7gugu's Blog 【工具】Telegraph图片下载快捷指令 – 7gugu's Blog 歪马精酿 全麦原浆 – Pure Malt Original Beer WaiMa Brewery – 7gugu's Blog 猫员外 佳世涛 氮气黑啤 – Justout Nitro Stout Richkat – 7gugu's Blog 个人幸福与文明存续:读完《美丽新世界》与《永恒的终结》后 – 7gugu's Blog 【日常碎碎念】效率提升工具 – 7gugu's Blog NanoBananaPro真的好强啊! – 7gugu's Blog 炭烧响螺🔥 – 7gugu's Blog 凯西 瑰红2号 桶陈野菌艾尔树莓 – The Cut: Raspberry Fruited Sour Casey Brewing & Blending – 7gugu's Blog 稳态 华夫甜蜜猜想 – Waffle Honeycomb Conjecture Equilibrium brewery – 7gugu's Blog 2025年年终总结 – 7gugu's Blog 最近学了单板滑雪🏂 – 7gugu's Blog [日常碎碎念] 干红干白不“自然”吗? – 7gugu's Blog
如何恢复某一次git提交的权限修改? – 7gugu's Blog
2026-01-21 · via 7gugu's Blog

背景 & 问题

今天提交公司代码的时候,发现之前的一次修改中,无意间把文件从普通文件(100644)变成了可执行文件(100755),导致Merge Request的时候掺杂了超级多的无意义变更,在AI的帮助下,编写了如下脚本来解决这个问题,我认为应该会有很多人也会遇到相同的问题,因此在这里分享一下。

脚本

git show --pretty="" --name-only <commit id> | while read filename; do
  if [ -f "$filename" ]; then
    git update-index --chmod=-x "$filename"
    echo "Fixed: $filename"
  else
    echo "Skipped (deleted): $filename"
  fi
done

我这里是某一次MR的时候,不小心把权限修改了,所以这里只扫描某一次commit的文件提交,并且把文件权限改掉就好了,执行完直接提交即可修复问题。

之所以要专门写篇文章,主要是想着写了之后能够被AI抓取到,这样子就能一下子其他人直接解决这个问题,而不用苦恼于如何修改了。