diff --git a/apps/desktop/src/lib/components/BaseBranch.svelte b/apps/desktop/src/lib/components/BaseBranch.svelte index f5d8b5ae0e..039246ac7b 100644 --- a/apps/desktop/src/lib/components/BaseBranch.svelte +++ b/apps/desktop/src/lib/components/BaseBranch.svelte @@ -1,5 +1,6 @@ {#if base.diverged}
- - - Your target branch has diverged from upstream. -
- Target branch is - - {`ahead by ${base.divergedAhead.length}`} - - commits and - - {`behind by ${base.divergedBehind.length}`} - - commits -
-
+ {#if !canPushBaseWithoutForce} + + + Your local target branch has diverged from upstream. +
+ Target branch is + + {`ahead by ${base.divergedAhead.length}`} + + commits and + + {`behind by ${base.divergedBehind.length}`} + + commits +
+
+ {:else} + + + Your local target branch is + + {`ahead by ${base.divergedAhead.length}`} + + commits + + + {/if}
{/if} @@ -198,8 +229,9 @@ icon="warning" kind="solid" tooltip={resetBranchTo.remote.tooltip} - disabled={$mode?.type !== 'OpenWorkspace'} - onclick={() => confirmResetBranch('remote')} + loading={baseBranchIsUpdating} + disabled={$mode?.type !== 'OpenWorkspace' || baseBranchIsUpdating} + onclick={async () => await confirmResetBranch('remote')} > {resetBranchTo.remote.title} @@ -234,13 +266,22 @@ {#snippet action()} {/snippet} @@ -327,9 +368,10 @@ {:else} You will force-push the local branch to the remote branch.
+
{base.divergedBehind.length > 1 - ? `The ${base.divergedBehind.length} changes in the remote branch will be lost.` - : 'The change in the remote branch will be lost.'} + ? `The ${base.divergedBehind.length} commits in the remote branch will be lost.` + : 'The commit in the remote branch will be lost.'} {/if}

diff --git a/apps/desktop/src/lib/navigation/TargetCard.svelte b/apps/desktop/src/lib/navigation/TargetCard.svelte index 0c1e25eae2..eed582ab52 100644 --- a/apps/desktop/src/lib/navigation/TargetCard.svelte +++ b/apps/desktop/src/lib/navigation/TargetCard.svelte @@ -19,6 +19,10 @@ $: base = baseBranchService.base; $: selected = $page.url.href.endsWith('/base'); $: baseBranchDiverged = !!$base?.diverged; + $: baseBranchAheadOnly = baseBranchDiverged && !!$base?.divergedBehind?.length === false; + $: divergenceTooltip = baseBranchAheadOnly + ? 'Your local target branch is ahead of its upstream' + : 'Your local target branch has diverged from its upstream'; {/if} {#if baseBranchDiverged} - +
- +
{/if}