Vinzent03 / obsidian-git

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

[Bug]: Merge Conflicts not supported on mobile? #340

Open tjcampanella opened 1 year ago

tjcampanella commented 1 year ago

Describe the bug

When attempting to pull on Obsidian mobile I get an error saying "MergeNotSupportedError: Merge with conflicts is not supported yet". I am unsure if this is a bug or it is just not supported yet like the message says. I saw an issue saying that merges should work on the Obsidian Git Mobile issue. If it is not supported then please let me know how I should handle this. Thanks.

Relevant errors (if available)

No response

Steps to reproduce

I have automatic pull enabled so when I startup Obsidian it attempts to pull down the changes however, it fails with a MergeNotSupportedError. I am unsure exactly what I did to cause this I assume I made some changes on my phone without syncing with my computer so things must have gotten out of sync.

Expected Behavior

No response

Addition context

No response

Operating system

iOS

Plugin version

2.6.0

glassoff commented 1 year ago

I have the same problem: I've got conflict on mobile and now can't make pull and as I right understand there are not in mobile ways to resolve conflicts :( At least it would be enough to have ability to open conflict file for manual conflict resolving.

@Vinzent03 you had discussion about conflicts in mobile version here Maybe our case helps you to resolve problem?

thebrianbug commented 1 year ago

I'm seeing this error as well and I'm not sure what to do

Vinzent03 commented 1 year ago

Sorry, but I can't reproduce. Are you sure you have the same root history? So the histories are not completely divergent?

thebrianbug commented 1 year ago

Ah, I see that I had the merge strategy set to rebase for my desktop and merge on my phone. Git has problems when trying to mix strategies. Trying both to "merge" to see if that's better

J-Emmerich commented 1 year ago

I was having the same issue with a fresh git install that I did in a new laptop. With my old laptop I had no issue to sync the mobile.
I reinstalled git and pushed a new file to the repository with plain git and the mobile synced fine. Then I installed obsidian-git and it started to work. :)

RedHotUnicorn commented 1 year ago

I have the same error. Laptop and iOS have merge strategy.

After trying "pull" I have message "MergeNotSupportedError" After trying "push" I have message "PushRejectedError: Push rejected because it was not a simple fast-forward. Use, "force: true" to override."

nirmalhk7 commented 1 year ago

I also have the same problem: I made the changes on my laptop yesterday and opened Obsidian on my mobile today. Seems like Obsidian ignored my changes on my laptop and simply pushed back to remote (wasn't a force push because the files I added on the laptop were shown as deleted). I tried to force push from my laptop, and voila: now when I open my phone I get a "MergeNotSupportedError".

Chiaoso commented 1 year ago

same problem on my Android phone. push: buffer error pull: MergeNotSupportedError. Anyway, I solved it through re-cloning the whole repo and restricting my operation on different divices.

freeman-jiang commented 1 year ago

Following this as well, is there no way to resolve merge conflicts on mobile? I suppose that adding a sort of git reset --hard command to mobile would solve many problems.

sickerin commented 1 year ago

One workaround is as follows:

  1. download iSH on the App Store (or other terminal emulators).
  2. apk add git
  3. mkdir -p /mnt/Obsidian
  4. mount -t ios null /mnt/Obsidian then a popup will show, add the Obsidian vault location.
  5. perform other git commands like reset, or try to resolve merge conflicts

Resources: link link2

Apps like Working Copy might work where you can add local repos, but I think it's a premium feature.

Not sure if like merge commits or rebases have caused pulling to stop working on my iPad, I remember seeing sth like only fast forwarding is recommended or sth.

sammorley-short commented 1 year ago

I have the same issue regularly, but here's how I solve it:

  1. On your mobile device, commit all changes to main.
  2. Create a branch called mobile and switch to it.
  3. On a non-mobile device running the same git repo, create a branch called mobile at the first commit of the repo, then push it to the remote (with branch name mobile.
  4. On your mobile device, push the mobile branch to get the current vault's state on the remote.
  5. On your other device, rebase the conflicting main onto mobile, resolve any conflicts, and then fast-forward mobile to the new main.
  6. On your mobile device, switch to main and pull the updated, resolved main. You now have resolved the conflict and both devices share the same main state.
  7. (Optional) delete the mobile branches on both devices and the remote.

(7 is optional because I have found it useful to maintain the mobile branch as a record of the last guaranteed point of agreement across clients, which means you don't have to reset to the initial commit if you need to repeat this process in the future.)

Hope this helps, good luck out there, and remember: commit early and often! 🚀

stevector commented 1 year ago

Thanks @sammorley-short! This work-around worked for me.