From 7b1e344d32acc00f05564b95a1fe3a41e4c90975 Mon Sep 17 00:00:00 2001 From: HouXiaoxuan Date: Thu, 28 Dec 2023 15:35:28 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96switch=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/commands/switch.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/commands/switch.rs b/src/commands/switch.rs index 812b9e1..ec8ad41 100644 --- a/src/commands/switch.rs +++ b/src/commands/switch.rs @@ -32,9 +32,11 @@ fn switch_to_commit(commit_hash: Hash) { fn switch_to(branch: String, detach: bool) -> Result<(), SwitchErr> { // 检查更改 if !status::changes_to_be_staged().is_empty() { + status::status(); println!("fatal: 你有未暂存的更改,切换分支会导致更改丢失"); return Err(SwitchErr::NoClean); } else if !status::changes_to_be_committed().is_empty() { + status::status(); println!("fatal: 你有未提交的更改,无法切换分支"); return Err(SwitchErr::NoClean); }