From c22686e1dd0440428dc7d81b19b14e30fb67cc9b Mon Sep 17 00:00:00 2001 From: Gabriel Date: Tue, 23 Dec 2025 15:29:57 +0000 Subject: [PATCH 1/9] Committed --- git_automation.sh | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100755 git_automation.sh diff --git a/git_automation.sh b/git_automation.sh new file mode 100755 index 0000000..16c32f6 --- /dev/null +++ b/git_automation.sh @@ -0,0 +1,15 @@ +#!/bin/bash +TRIGGER_FILE="/tmp/please_update" + +echo "[INFO] Watching $TRIGGER_FILE..." +while true; do + if [[ -f "$TRIGGER_FILE" ]]; then + rm -f "$TRIGGER_FILE" + echo "[INFO] Triggered at $(date)" + git status + git add . + git commit -m "Committed" + git push + fi + sleep 0.5 +done -- 2.49.1 From c675e1f1a1c9d4d43626dff3f2d3c413f0b81f8b Mon Sep 17 00:00:00 2001 From: Gabriel Date: Tue, 23 Dec 2025 15:44:40 +0000 Subject: [PATCH 2/9] Committed --- git_automation.sh | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/git_automation.sh b/git_automation.sh index 16c32f6..db21dba 100755 --- a/git_automation.sh +++ b/git_automation.sh @@ -1,7 +1,17 @@ #!/bin/bash + +#Variable to store the trigger file path TRIGGER_FILE="/tmp/please_update" +# An alias so i no longer have to type the full command +alias trigger_git="touch $TRIGGER_FILE" + +#The magic itself echo "[INFO] Watching $TRIGGER_FILE..." +echo "[INFO] To trigger a git commit and push, run: trigger_git" +echo "PLEASE make sure that you have a good .gitignore file set up to avoid committing unwanted files." + +#Do not know if the runs forrever loop is the best way to do this but it works while true; do if [[ -f "$TRIGGER_FILE" ]]; then rm -f "$TRIGGER_FILE" -- 2.49.1 From fe52d8a08164592b127a1417f6925574fd8b2006 Mon Sep 17 00:00:00 2001 From: Gabriel Date: Tue, 23 Dec 2025 15:46:58 +0000 Subject: [PATCH 3/9] Committed --- git_automation.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/git_automation.sh b/git_automation.sh index db21dba..09ed251 100755 --- a/git_automation.sh +++ b/git_automation.sh @@ -1,11 +1,12 @@ #!/bin/bash +#Before running this script, make sure that you added an alias to your shell config file (~/.bashrc, ~/.zshrc, etc.) +#alias trigger_git='touch /tmp/please_update' +#Then run source ~/.zshrc to load the new alias + #Variable to store the trigger file path TRIGGER_FILE="/tmp/please_update" -# An alias so i no longer have to type the full command -alias trigger_git="touch $TRIGGER_FILE" - #The magic itself echo "[INFO] Watching $TRIGGER_FILE..." echo "[INFO] To trigger a git commit and push, run: trigger_git" -- 2.49.1 From 4056e5eefabac8694f57ffdebf1622ff85c5cda7 Mon Sep 17 00:00:00 2001 From: Gabriel Date: Tue, 23 Dec 2025 15:48:32 +0000 Subject: [PATCH 4/9] Committed --- git_automation.sh | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/git_automation.sh b/git_automation.sh index 09ed251..c2f3107 100755 --- a/git_automation.sh +++ b/git_automation.sh @@ -16,11 +16,23 @@ echo "PLEASE make sure that you have a good .gitignore file set up to avoid comm while true; do if [[ -f "$TRIGGER_FILE" ]]; then rm -f "$TRIGGER_FILE" + echo "[INFO] Triggered at $(date)" + + # Prompt the user for a commit message + read -rp "Enter commit message: " COMMIT_MSG + # Fallback if the user presses enter without typing a message + if [[ -z "$COMMIT_MSG" ]]; then + COMMIT_MSG="Committed" + fi + + # Run Git commands git status git add . - git commit -m "Committed" + git commit -m "$COMMIT_MSG" git push + + echo "[INFO] Git commands completed at $(date)" fi sleep 0.5 done -- 2.49.1 From 6da42bd82d141905856f38c3ac406d56e21a25b0 Mon Sep 17 00:00:00 2001 From: Gabriel Date: Tue, 23 Dec 2025 15:49:34 +0000 Subject: [PATCH 5/9] Committed --- git_automation.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/git_automation.sh b/git_automation.sh index c2f3107..a2211d7 100755 --- a/git_automation.sh +++ b/git_automation.sh @@ -36,3 +36,4 @@ while true; do fi sleep 0.5 done + -- 2.49.1 From c21e077780a90aa26142249019681420642c9a68 Mon Sep 17 00:00:00 2001 From: Gabriel Date: Tue, 23 Dec 2025 15:50:21 +0000 Subject: [PATCH 6/9] Committed --- git_automation.sh | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/git_automation.sh b/git_automation.sh index a2211d7..ab1b9cd 100755 --- a/git_automation.sh +++ b/git_automation.sh @@ -19,9 +19,7 @@ while true; do echo "[INFO] Triggered at $(date)" - # Prompt the user for a commit message - read -rp "Enter commit message: " COMMIT_MSG - # Fallback if the user presses enter without typing a message + read -rp "Enter commit message: " COMMIT_MSG Date: Tue, 23 Dec 2025 15:50:59 +0000 Subject: [PATCH 7/9] Committed --- git_automation.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/git_automation.sh b/git_automation.sh index ab1b9cd..a0abf66 100755 --- a/git_automation.sh +++ b/git_automation.sh @@ -26,8 +26,11 @@ while true; do # Run Git commands git status + sleep 0.5 git add . + sleep 0.5 git commit -m "$COMMIT_MSG" + sleep 0.5 git push echo "[INFO] Git commands completed at $(date)" -- 2.49.1 From 1be8442480c7910156f464d166ebc58dda8c2871 Mon Sep 17 00:00:00 2001 From: Gabriel Date: Tue, 23 Dec 2025 15:52:12 +0000 Subject: [PATCH 8/9] Committed --- git_automation.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/git_automation.sh b/git_automation.sh index a0abf66..d9723c6 100755 --- a/git_automation.sh +++ b/git_automation.sh @@ -32,6 +32,7 @@ while true; do git commit -m "$COMMIT_MSG" sleep 0.5 git push + echo "[INFO] Git commands completed at $(date)" fi -- 2.49.1 From 5e68ab0ee4d0efb19485352f1fe3593938774095 Mon Sep 17 00:00:00 2001 From: Gabriel Date: Tue, 23 Dec 2025 15:54:48 +0000 Subject: [PATCH 9/9] Committed --- git_automation.sh | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/git_automation.sh b/git_automation.sh index d9723c6..6f87243 100755 --- a/git_automation.sh +++ b/git_automation.sh @@ -12,6 +12,7 @@ echo "[INFO] Watching $TRIGGER_FILE..." echo "[INFO] To trigger a git commit and push, run: trigger_git" echo "PLEASE make sure that you have a good .gitignore file set up to avoid committing unwanted files." +DEFAULT_COMMIT_MSG="Committed" #Do not know if the runs forrever loop is the best way to do this but it works while true; do if [[ -f "$TRIGGER_FILE" ]]; then @@ -19,20 +20,21 @@ while true; do echo "[INFO] Triggered at $(date)" - read -rp "Enter commit message: " COMMIT_MSG