Skip to content
/ git-auto Public
forked from logseq/git-auto

A Simple Shell Script To Do Git Commit And Push Automatically

License

Notifications You must be signed in to change notification settings

Bad3r/git-auto

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

git-auto

A Simple Shell Script To Commit And Push Automatically

Usage

Download the git-auto file

$ chmod +x git-auto
./git-auto
# Auto run on opening logseq on linux
# Modify logseq desktop entry, e.g in /usr/share/applications/logseq-desktop.desktop
Exec=/bin/sh -c "/path/to/git-auto -d /path/to/logseq -pr & bg=$!; logseq; kill $bg"

Default behaviour:

  • The script will exit if there is already another instance is running, use -a to bypass this.
  • If it is interrupted before the next commit/push interval, the current changes will not be committed/pushed. Use -e to always make a final commit/push upon exit.

More samples:

##  git-auto ;; use current script dir as git dir, and auto commit, not push.
##  git-auto -d /path/to/your/note's/dir   ;; set git dir
##  git-auto -i 30 -p ;; set interval seconds
##  git-auto -m "Commit from desktop" ;; set commit message for all commits
##  git-auto -b main -p ;; set git branch
##  git-auto -s origin -p ;; set remote server
##  git-auto -p ;; auto commit and push
##  git-auto -r ;; auto commit, rebase, merge, push
##  git-auto -o -p;; execute once

For Windows Users

Before you proceed to use the git-auto file, please make sure Git installed, otherwise please download Git and install it.

  1. Just click 'yes' all the way down and you will find Git Bash icon in the start.

  2. Open PowerShell

Download the target repository if you don't have it locally yet:

git clone [your_repo_url]
cd [your_repo_location]

For those who don't yet have a repository on Github, please refer to https://docs.github.com/en/github/getting-started-with-github/create-a-repo.

  1. Usage

Download the Start-GitAutoCommit.ps1 file, and run

.\Start-GitAutoCommit.ps1

More samples:

Start-GitAutoCommit # use current script dir as git dir, and auto commit, not push.
Start-GitAutoCommit -d /path/to/your/note's/dir   # set git dir
Start-GitAutoCommit -p # auto commit and push
Start-GitAutoCommit -s origin -p # set remote server
Start-GitAutoCommit -b main -p # set git branch
Start-GitAutoCommit -i 30 -p # set interval seconds
Start-GitAutoCommit -o -p # execute once

Contributors

Thanks for your work!

PowerShell Port, by @batkiz

Readme-CN.md & Git Bash docs, by @zhanghanduo

License

Copyright © 2020 Michael Wong

Distributed under the MIT License.

About

A Simple Shell Script To Do Git Commit And Push Automatically

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Shell 71.6%
  • PowerShell 28.4%