MCPcopy Create free account
hub / github.com/7BEII/Comfyui_PDuse / commit_changes

Method commit_changes

gittools.py:165–193  ·  view source on GitHub ↗

提交本地更改

(self, message=None)

Source from the content-addressed store, hash-verified

163 print("✅ 当前分支已是 main")
164
165 def commit_changes(self, message=None):
166 """提交本地更改"""
167 if not self.has_changes():
168 print("ℹ️ 没有需要提交的更改")
169 return True
170
171 print("\n📝 检测到以下更改:")
172 self.run_command("git status --short")
173
174 if message is None:
175 message = input("\n请输入提交信息: ").strip()
176
177 if not message:
178 print("❌ 提交信息不能为空")
179 return False
180
181 # 添加所有更改
182 print("\n📦 正在暂存所有更改...")
183 result = self.run_command("git add -A")
184 if not result:
185 return False
186
187 # 提交更改
188 print(f"💾 正在提交: {message}")
189 result = self.run_command(f'git commit -m "{message}"')
190 if result:
191 print(f"✅ 提交成功")
192 return True
193 return False
194
195 def get_commit_hash(self, ref):
196 """读取指定引用的提交哈希"""

Callers 2

force_pushMethod · 0.95
smart_syncMethod · 0.95

Calls 2

has_changesMethod · 0.95
run_commandMethod · 0.95

Tested by

no test coverage detected