Files
huse-lab/docs/2025-exam/exam-2.md
2025-09-30 07:21:36 +08:00

44 lines
1.3 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
sidebar_position: 6
sidebar_label: '测试题 - 2'
title: '测试题 - 2'
---
## 要求
学习和使用 Git 工具,
能理解下列术语的含义和使用相应的执行命令:
- 暂存
- 提交
- 撤销修改
- 版本回退
- 创建分支、合并分支
## 帮助
> 空泛的、漫无目的地学习是令人厌恶的,
>
> 这里给一个辅助场景
首先,自行搜索或任何方式准备两首诗或任何文段,
下文中以诗A和诗B指代
### 场景此场景由AI生成见尾图
现在是上午9点你吃完早餐后心有所感打开文档写下了诗A。这时有人找你你使用 `git add` 暂存了当前修改。
随后你继续修改添加了诗B并用 `git commit` 提交了这次更改,附上备注“添加两首诗”。
检查时发现诗B有一处错误你使用 `git checkout --` 撤销了对诗B的修改。
之后你意识到整个提交都不需要,于是用 `git reset --hard HEAD^` 回退到了上一个版本。
接着你创建了一个新分支(`git branch new-branch`来尝试改写诗A完成后再切换回主分支`git checkout main`)并使用 `git merge new-branch` 合并了修改。
---
![image-20250930060036766](https://sayurinana-aliyun-oss.oss-cn-beijing.aliyuncs.com/auto-upload-img-hub/huse-lab/20250930070944185.png)