From 4bb8afde02a4e2e08499001e2052f4cf1a74b9ee Mon Sep 17 00:00:00 2001 From: Richard Macklin Date: Thu, 17 Jul 2025 23:06:25 -0700 Subject: [PATCH] Reset any stash changes before proceeding if there were conflicts If the worktree has conflicts after applying the user's changes from the autostash, we should reset them before proceeding to ensure we are in a working state. When there are conflicts, git still keeps the stash entry, so the user will still be able to manually re-pop the stash and resolve the conflicts after `omarchy-update` has finished. In the case of conflicts, the output will look something like this (I've omitted most of the normal `git pull` output, hence the `[...]`): ``` Updating 729cd6a..45b5d3e Created autostash: 91853c4 Fast-forward bin/omarchy | 10 +++++++--- [...] create mode 100644 themes/tokyo-night/backgrounds/2--Milad-Fakurian-Abstract-Purple-Blue.jpg Applying autostash resulted in conflicts. Your changes are safe in the stash. You can run "git stash pop" or "git stash drop" at any time. bin/omarchy:65: leftover conflict marker ``` before proceeding with the rest of the `omarchy-update` script from a clean state. So the user will see 1) that there were conflicts when applying the autostashed changes, 2) that their changes are still safe in the stash, and 3) which files (and lines) had conflict markers. --- bin/omarchy-update | 1 + 1 file changed, 1 insertion(+) diff --git a/bin/omarchy-update b/bin/omarchy-update index 6a71409..9eadcf8 100755 --- a/bin/omarchy-update +++ b/bin/omarchy-update @@ -12,6 +12,7 @@ fi # Get the latest while trying to preserve any modifications git pull --autostash +git diff --check || git reset --merge # Run any pending migrations for file in migrations/*.sh; do