Create repo-helper.sh
Browse files- repo-helper.sh +28 -0
repo-helper.sh
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
cd /workspace/projects
|
| 3 |
+
|
| 4 |
+
case "$1" in
|
| 5 |
+
clone)
|
| 6 |
+
if [ -z "$2" ]; then echo "Usage: repo clone <github-url>"; exit 1; fi
|
| 7 |
+
git clone "$2"
|
| 8 |
+
echo "Cloned into $(basename "$2" .git)"
|
| 9 |
+
;;
|
| 10 |
+
save)
|
| 11 |
+
MSG="${2:-Auto-save from OpenCode}"
|
| 12 |
+
git add .
|
| 13 |
+
git commit -m "$MSG" || echo "Nothing to commit."
|
| 14 |
+
git push
|
| 15 |
+
echo "Pushed to GitHub. Your deployment platform will now auto-deploy."
|
| 16 |
+
;;
|
| 17 |
+
new)
|
| 18 |
+
if [ -z "$2" ]; then echo "Usage: repo new <folder-name>"; exit 1; fi
|
| 19 |
+
mkdir "$2" && cd "$2"
|
| 20 |
+
git init
|
| 21 |
+
echo "# $2" > README.md
|
| 22 |
+
git add . && git commit -m "Initial commit"
|
| 23 |
+
echo "Created local repo. Create it on GitHub, then run: git remote add origin <url> && git push -u origin main"
|
| 24 |
+
;;
|
| 25 |
+
*)
|
| 26 |
+
echo "Usage: repo [clone|save|new]"
|
| 27 |
+
;;
|
| 28 |
+
esac
|