From 19384439f239a977f26f29bf452e9d105808b269 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A0=91=E8=90=8C=E8=8A=BD?= <3205788256@qq.com> Date: Mon, 16 Feb 2026 00:01:44 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8A=A0=E4=B8=AA=E5=B0=8F=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AGENTS.md | 1 + README.md | 4 ++++ quickgit/ui.py | 4 ++++ quickgit/utils.py | 5 +++++ 4 files changed, 14 insertions(+) diff --git a/AGENTS.md b/AGENTS.md index 0d6dce8..7b2ea07 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -223,6 +223,7 @@ OutputFormatter.success("Done!") # [√] Green success OutputFormatter.error("Failed!") # [×] Red error OutputFormatter.info("Note...") # [i] Cyan info OutputFormatter.warning("Warning!") # [!] Yellow warning +OutputFormatter.tip("Tip...") # [*] Cyan tip/suggestion OutputFormatter.step(1, "Step one") # [1] Step indicator OutputFormatter.menu_item(1, "Option") # [1] Menu item ``` diff --git a/README.md b/README.md index 62791c2..babd2c8 100644 --- a/README.md +++ b/README.md @@ -150,6 +150,10 @@ python mengya_git_manager.py 3. 推送到Gitea时请确保仓库已在服务器上创建 +4. **重要提示:** 提交代码前建议先拉取最新代码,减少代码冲突 + - 先执行 `3. 从远程仓库拉取` + - 再执行 `2. 提交并推送更改` + ## 常见问题 **Q: 推送失败怎么办?** diff --git a/quickgit/ui.py b/quickgit/ui.py index ffcd399..a07e5a0 100644 --- a/quickgit/ui.py +++ b/quickgit/ui.py @@ -60,6 +60,10 @@ class GitManagerUI: OutputFormatter.error("当前目录不是Git仓库,请先初始化") return + # 提示:先拉取再提交 + OutputFormatter.tip("建议先拉取最新代码再提交,减少代码冲突") + print(f"{Colors.CYAN}{'-' * 60}{Colors.ENDC}") + # 检查是否有更改 OutputFormatter.status('running', "检查文件更改中...") diff --git a/quickgit/utils.py b/quickgit/utils.py index 2cd67b4..7c73b14 100644 --- a/quickgit/utils.py +++ b/quickgit/utils.py @@ -130,6 +130,11 @@ class OutputFormatter: """打印警告信息""" print(f"{Colors.BRIGHT_YELLOW}[!]{Colors.ENDC} {Colors.YELLOW}{text}{Colors.ENDC}") + @staticmethod + def tip(text: str): + """打印提示信息""" + print(f"{Colors.BRIGHT_CYAN}[*]{Colors.ENDC} {Colors.CYAN}{text}{Colors.ENDC}") + @staticmethod def step(num: int, text: str): """打印步骤信息"""