OblikStudio / kirby-git

Kirby plugin for updating content in the panel via Git
MIT License
84 stars 6 forks source link

autocommit changes? #33

Closed rapsli closed 1 year ago

rapsli commented 1 year ago

is there a way to autocommit changes and push them. That would be a great and easy backkup.

hdodov commented 1 year ago

There is no built-in way, but as mentioned in the docs, you could use the Git class to do it yourself. I guess that something like this, using the page.update:after hook, would do the trick:

use Oblik\KirbyGit\Git;

return [
    'hooks' => [
        'page.update:after' => function () {
            $git = new Git();
            $git->add();
            $git->commit('my message');
            $git->push();
        }
    ]
];
rapsli commented 1 year ago

Great. That did the job!