git_x/undo.rs
1use std::process::Command;
2
3pub fn run() {
4 let status = Command::new("git")
5 .args(["reset", "--soft", "HEAD~1"])
6 .status()
7 .expect("Failed to execute git reset");
8
9 if status.success() {
10 println!("Last commit undone (soft reset). Changes kept in working directory.");
11 } else {
12 eprintln!("❌ Failed to undo last commit.");
13 }
14}