trilbymedia / grav-plugin-git-sync

Collaboratively Synchronize your Grav `user` folder hosted on GitHub, BitBucket or GitLab
Apache License 2.0
243 stars 58 forks source link

Multiple branches while syncing plugin's config #197

Closed ghost closed 3 years ago

ghost commented 3 years ago

Hi all,

I have a git repository using multiple branches and each of them is served by a dedicated grav application.

Everything goes very well if I sync the pages and template directories. As I don't always remember all the setup done in one branch (and since it's not very clean to manuall copy the config directory between instances), I synced the plugin's directory (which work pretty well for all plugins except the git-sync one).

As the plugin config contains the local and remote branch name, every time I merge branch, this setting is overwritten and I must manually fix it in the grav's admin panel.

I thought I could use some .gitignore trick to ignore this specific plugin directory but saw #117.

Do you have some advices or best practices for such cases (having two grav, following different branches) ?

w00fz commented 3 years ago

I think what I need to do is to add an advanced textarea field where you can specify your gitignore, so that when GitSync does its thing, it will also include the custom entries.

Do you think that would help with the issue?

ghost commented 3 years ago

Any way to tell the plugin to ignore its own config file will help me. A "true/false" to tell grav to read the official gitignore file, a "filename" field to tell grav where it will find a gitignore file or a textarea with a content formatted like a gitignore file (your proposal) wille help me.

The textarea has a good side effect because, I can still version a git-sync configuration in my repo :

Note that I don't need the second case (because merging setup files that contains branch names need to check the name after merge and re-commit to correct if it is the wrong one).

w00fz commented 3 years ago

I've got this implemented, going to be releasing it soon as v2.3.0. Thanks for this suggestion, going to be very useful.


w00fz-2021-04-27_@_10 25 01@2x
ghost commented 3 years ago

I've just updated my plugin and put the git-sync config in the ignore list as follows :

image

After I saved the plugin state, It commited the setup modification in my repo :

image

Since then, whatever I change in the configuration file, it's not updated (as expected) :

Thanks a lot :-)

w00fz commented 3 years ago

Happy to hear this is working as you expected! 👍