gykim commited on
Commit ยท
8a8ed61
1
Parent(s): 0f5f063
Add git_helper.py
Browse files- git_helper.py +36 -0
git_helper.py
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
import subprocess
|
| 3 |
+
import os
|
| 4 |
+
|
| 5 |
+
def run_git_command(command):
|
| 6 |
+
"""git ๋ช
๋ น์ ์คํํ๊ณ ๊ฒฐ๊ณผ๋ฅผ ์ถ๋ ฅ"""
|
| 7 |
+
try:
|
| 8 |
+
result = subprocess.run(command, shell=True, capture_output=True, text=True, cwd=".")
|
| 9 |
+
print(f"Command: {command}")
|
| 10 |
+
print(f"Exit code: {result.returncode}")
|
| 11 |
+
if result.stdout:
|
| 12 |
+
print(f"Output:\n{result.stdout}")
|
| 13 |
+
if result.stderr:
|
| 14 |
+
print(f"Error:\n{result.stderr}")
|
| 15 |
+
print("-" * 50)
|
| 16 |
+
return result.returncode == 0
|
| 17 |
+
except Exception as e:
|
| 18 |
+
print(f"Error running command: {e}")
|
| 19 |
+
return False
|
| 20 |
+
|
| 21 |
+
if __name__ == "__main__":
|
| 22 |
+
# Git ์์
์์๋๋ก ์คํ
|
| 23 |
+
commands = [
|
| 24 |
+
"git add .",
|
| 25 |
+
"git commit -m 'Initial commit: LaonA2 VL 3B model'",
|
| 26 |
+
"git remote -v",
|
| 27 |
+
"git push -u origin main --force"
|
| 28 |
+
]
|
| 29 |
+
|
| 30 |
+
for cmd in commands:
|
| 31 |
+
print(f"\n๐ Executing: {cmd}")
|
| 32 |
+
success = run_git_command(cmd)
|
| 33 |
+
if not success and "push" in cmd:
|
| 34 |
+
print("Push failed, continuing...")
|
| 35 |
+
elif not success and "commit" in cmd:
|
| 36 |
+
print("Commit may have failed due to no changes, continuing...")
|