juechafun/03-资源/操作说明-工具技巧-git单文件回滚.md

474 B


#领域/工具技巧

#复盘/0

一句话描述

[对单文件进行回滚操作__]


# 查看单一文件的提交记录
git log --oneline test.py

git resore 方法 Git 2.23+

git restore --source=HEAD~1 test.py
git restore --source=f4g5h6j test.py
git restore --source=f4g5h6jabcdef1234 test.py  # 完整ID也可

git checkout 旧版 Git 兼容

git checkout HEAD^1 -- test.py
git checkout f4g5h6j -- test.py