Replies: 2 comments 2 replies
-
No there is currently not. There is only a command to delete all changes since the last commit. That may help already, but does not fix all issues. |
Beta Was this translation helpful? Give feedback.
-
Whenever using the Obsidian App to open a Vault synced by Obsidian Git on multiple devices, I always first open Termux on my Android device, which has a cron job for auto-sync (see below for references on how to set this up). Then I open the Obsidian vault. This helps to keep the vault changes from mobile always in sync. There could be cases where we have the same vault opened in parallel on the desktop and may face merge conflicts. In such cases, I use the following script to reset things: For Linux or Android (Use Termux), create a script in the root directory #!/bin/bash
# Fetch the latest information from the remote repository
git fetch origin
# Check for merge conflicts
mergeConflicts=$(git ls-files -u)
if [ -n "$mergeConflicts" ]; then
echo "Merge conflict detected. Resetting the repository..."
# Reset the repository to the HEAD of the remote repository
git reset --hard origin/HEAD
# Pull the latest changes
git pull origin main
else
echo "No merge conflicts detected. Pulling the latest changes..."
# Pull the latest changes
git pull origin main
fi For Windows, create a script in the root directory # Fetch the latest information from the remote repository
git fetch origin
# Check for merge conflicts
$mergeConflicts = git ls-files -u
if ($mergeConflicts) {
Write-Output "Merge conflict detected. Resetting the repository..."
# Reset the repository to the HEAD of the remote repository
git reset --hard origin/HEAD
# Remove untracked files
# git clean -fd
# Pull the latest changes
git pull origin main
} else {
Write-Output "No merge conflicts detected. Pulling the latest changes..."
# Pull the latest changes
git pull origin main
} References |
Beta Was this translation helpful? Give feedback.
-
I have a conflict so that I can't pull changes from GitHub. At this point I don't really care about my changes on my phone, I just want to be able to use Obsidian. Is there a way to essentially run
git pull --force
from the mobile app? I have run into this problem before and the way I fixed it was by deleting my vault (on my phone) and then creating a new one and cloning the repo. I don't want to have to do that every time I run into this (especially with how tedious the authentication is for mobile)Beta Was this translation helpful? Give feedback.
All reactions