manuskript icon indicating copy to clipboard operation
manuskript copied to clipboard

Script for automatic git push

Open FastusNumen opened this issue 11 months ago • 2 comments

I wrote two scripts to automate the git push.

Since I'm a noob with coding and scripting, I'd like to ask if you think there'll be a problem with them, though.

I first created a "push.sh" file to automate the push to GitHub:

#!/bin/bash

echo "***********************************************************" &>> log_push.txt

date '+%A %d/%m/%Y %X' &>> log_push.txt

git add . &>> log_push.txt

git commit -m 'Routine edit' &>> log_push.txt

git push &>> log_push.txt

Then I created "run_manuskript-push.sh" to automatically start Manuskript and then push to GitHub when I close it:

#!/bin/bash

python ~/Desktop/Manuskript/manuskript/bin/manuskript

sh push.sh

The scripts are both on the folder with the .msk file, where the .git is, and when I double click them they automatically open the script in the Git Bash.

This way, I only have to go to my fiction folder, double-click on "run_manuskript-push.sh", and Manuskript starts.

When I close it, the script starts "push.sh" without me doing anything.

Btw, "push.sh" saves the output of the terminal in "log_push.txt", in case there are problems.

It seems to be working well now, but what do you think?

I'm using Windows 11.

Edit: I added "log_push.txt" to ".gitignore", since I couldn't find a way to write the terminal text only after it finished the commands. There's also still the line feed problem #1287 .

FastusNumen avatar Mar 04 '24 16:03 FastusNumen