简体   繁体   中英

Git: Auto commit contents of a windows folder

We have a shared folder on our network. Is there a way to auto commit and push the changes of the folder (say every hour) to the remote Stash repository? Thanks.

There's a bunch of opensource tools to do git autocommit. However, they solve a slightly different task: making a commit just after a change is detected.

https://github.com/mvgrimes/git-autocommit

https://github.com/riddochc/git-autocommit

Also, you can make a batch file and schedule it to run each hour:

#!/bin/sh
cd path/to/your/project
git add --all
timestamp() {
  date +"at %H:%M:%S on %d/%m/%Y"
}
git commit -am "Regular auto-commit $(timestamp)"
git push

If anyone knows how to insert a timestamp in batch file, you're welcome to edit this answer.

You can do it if you convert the folder to a git project and then by adding hooks it can do what ever you want on every commit and or push that was made.

If its not a git repository you will need some other third party to handle it for you.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM