32 lines
474 B
Markdown
32 lines
474 B
Markdown
|
|
---
|
|
#领域/工具技巧
|
|
|
|
#复盘/0
|
|
|
|
## 一句话描述
|
|
|
|
[___对单文件进行回滚操作_____]
|
|
|
|
---
|
|
|
|
```bash
|
|
# 查看单一文件的提交记录
|
|
git log --oneline test.py
|
|
```
|
|
|
|
## git resore 方法 Git 2.23+
|
|
|
|
```bash
|
|
git restore --source=HEAD~1 test.py
|
|
git restore --source=f4g5h6j test.py
|
|
git restore --source=f4g5h6jabcdef1234 test.py # 完整ID也可
|
|
```
|
|
|
|
## git checkout 旧版 Git 兼容
|
|
|
|
```bash
|
|
git checkout HEAD^1 -- test.py
|
|
git checkout f4g5h6j -- test.py
|
|
```
|