obsidian-git icon indicating copy to clipboard operation
obsidian-git copied to clipboard

[Bug]: wrong order in git backup

Open LFSaw opened this issue 1 year ago • 3 comments

Describe the bug

Merge conflicts when doing Git: Create backup in a 2 machine scenario

Relevant errors (if available) from notifications or console (CTRL+SHIFT+I)

No response

Steps to reproduce

  • 2 instances of obsidian vault on different machines (A , B), each with the same obsidian-git settings (apart from machine ID)
  • edit the same file on machine A and B
  • Git: Create backup on machine A
  • Git: Create backup on machine B

results in merge conflict.

Expected Behavior

no merge conflict.

This could be achieved by a git command sequence within Git: Create backup:

  1. git commit
  2. git pull [--rebase]
  3. git push

Addition context

No response

Operating system

macOS

Installation Method

None

Plugin version

2.24.1

LFSaw avatar Apr 09 '24 09:04 LFSaw

I don't think this is an issue with the plugin. You just create a merge conflict, which the plugin can't solve more than git. You can set rebase to be used when pulling in the settings.

Vinzent03 avatar Apr 09 '24 10:04 Vinzent03

Thanks for taking the time looking into this!

I'd just like to have configuration in which I can save changes from both machines (as in the above scenario) in one action (per machine) without creating a merge conflict. I just tried using the "rebase" setting; unfortunately this does not change that I get an error message, however, it seems not to create a merge conflict...

The sequence

  1. edit file example.md on machine A
  2. edit file example.md on machine B (different edit)
  3. Git: Create backup on machine A
  4. git commit on machine B
  5. git pull --rebase on machine B
  6. git push on machine B

works for me without a merge conflict and without an error (given that an automatic merge is possible).

LFSaw avatar Apr 09 '24 16:04 LFSaw

Please share your error messsage. So you are editing the file in two different places, right?

Vinzent03 avatar Apr 10 '24 11:04 Vinzent03