A simple script to commit and push automatedly for the desktop app

Hi guys,

I write a simple script to commit and push automatedly for the desktop app.

script on gist: auto push to Github when files change · GitHub

The note directory should be a git directory.

The script will check the file changes every 10 seconds and commit and push to the origin server master branch automatedly when there is a file change.

Any suggestion is welcome.

Updated: Add some more optional arguments.

Addition: Add git repo: https://github.com/defclass/git-auto, PRs or suggestions are welcome.

Transferred to logseq org: GitHub - logseq/git-auto: A Simple Shell Script To Do Git Commit And Push Automatically [2021-03-11]

4 Likes

hey thanks for this, awesome idea since the desktop app is awesome and can’t wait for github integration.

Is there any way to have automatic pulls as well perhaps?

Also does it work the same on Linux and mac, I use both and not sure if there are any particular differences that I should be aware of for this script to work

Thanks for sharing your work!

Hey, @santi

I have not Linux machine on hand right now; however, it should work on Linux also. Let me know if it doesn’t work.

Implement automatic pulls are quite direct in the shell script, but the potential git conflict is complicated. The script might fit simple backup scenes only, two-way synchronization may be problematic.

1 Like

I just tried it on archlinux and it works :grinning_face_with_smiling_eyes:

You can use cron job with git pull, but you need to be careful with the potential git conflicts as @defclass said.

1 Like

This is awesome. Is there any possibility to pack it into an app? I’ll look into it on a Mac but if someone has already done something like this, it’d be great to have a hint.

2 Likes

We’ll start working on the extensions API next week, which can provide git and other commands for the extensions authors.

2 Likes

awesome thanks for the tips! @tienson and @defclass

1 Like

+1 on awesomeness. Looking forward to playing with the new API.

1 Like