Vinzent03 / obsidian-git

Integrate Git version control with automatic backup and other advanced features in Obsidian.md
MIT License
6.86k stars 294 forks source link

[Enhancement] Multiple remotes support #707

Open martinpcobo opened 8 months ago

martinpcobo commented 8 months ago

Currently this plugin only allows to push changes to the default remote automatically. My proposed enhancement would allow the user to select which remotes the plugin should automatically push the changes to after a commit.

In my case, I've been using one Git repository for source controlling my Vault and another one for backup/redundancy. Everytime I want to backup my vault, I have to manually go into the console and push the updates to my other remote.

Let me know if this makes sense.

Vinzent03 commented 8 months ago

I currently don't plan to implement that feature, because I don't think many people would use it. As a workaround, you should be able to use the "Set upstream branch" command to switch to a different branch, push and switch back.

washogren commented 2 months ago

@martinpcobo @ekalinin @g-h-97 You can support this today by setting a "merged" or an "all" remote that has multiple remotes in it. If you do that then when this plugin does push/pull it'll push/pull to all of the remotes you've added.

For ex, this adds an "all" remote that pushes/pulls from 2 git remotes at once sequentially.

git remote add all <remote1>
git remote set-url all --add <remote2>

Then you can set it as the default target by pushing:

git push --set-upstream all main