Skip to content

feature: show local changes as a node in the commit graph (optional) - #2829

Open
pitetb wants to merge 1 commit into
sourcegit-scm:developfrom
pitetb:feature/local-changes-in-graph
Open

pitetb wants to merge 1 commit into
sourcegit-scm:developfrom
pitetb:feature/local-changes-in-graph

Conversation

@pitetb

@pitetb pitetb commented Oct 28, 2026

Copy link
Copy Markdown

Summary

Adds an optional display mode that shows the working copy (local changes) as a node of the commit graph, "not yet attached" to the history, directly in the Dashboard view.
This allow us to see and commit current changes directly on the graph without needing to click on the "Loca changes" button on the left column. This feature exists in Gitkraken or Fork and is very convenient.

The option is disabled by default and can be toggled from the graph's advanced options menu (⚙ → Local changes as graph node). The existing Local Changes page is unchanged.

Capture d’écran 2026-10-28 à 09 24 22 Capture d’écran 2026-10-28 à 09 23 58

Behavior

When the option is enabled and the working copy has changes, a pseudo commit "Local changes (N)" is inserted at the top of the history:

  • Graph: drawn as a dashed hollow dot, linked to HEAD with a dashed line. Only that link is dashed; the rest of the branch is drawn as usual.
  • Select the node: the details panel shows the full local changes view (stage/unstage, diff, commit message box).
  • Select the node + one commit: compares that commit with the worktree (same as Compare with Worktree).
  • Context menu: Stash, Discard all changes, Open in Local Changes page.
  • Double-click: opens the Local Changes page (no checkout).
  • After commit / stash / discard: if the node was selected and disappears, the current HEAD is selected (then the new HEAD once commits are refreshed).
  • The node is not shown for bare repositories, or when HEAD is not part of the loaded history (branch filters, commit limit).
  • Author / SHA / time columns are left empty for this row, and Ctrl+C ignores it.

Implementation

  • Models.LocalChangesNode: new Commit subclass with a sentinel SHA and an observable Count; Commit.IsLocalChanges (virtual) is used by views and graph.
  • ViewModels.Histories: inserts/removes/updates the node (ApplyLocalChangesNode / RefreshLocalChangesNode) without regenerating the graph when only the count changes; selection handling for the new cases.
  • ViewModels.Repository: refreshes the node after querying local changes.
  • Models.CommitGraph: new DotType.LocalChanges and Path.IsDashed; the node's path is split at HEAD (PathHelper.Detach()) so that only the link to HEAD is dashed.
  • Views.CommitGraph: renders dashed paths and the new dot type.
  • Views.Histories: row template, WorkingCopy data template in the details panel, menu entry, context menu, double-click handling.
  • Preferences.ShowLocalChangesInGraph: new global preference.
  • Localization: new keys added to all locales. The node label uses a DynamicResource, so it follows runtime locale changes. Non-English/French translations were not reviewed by native speakers; corrections welcome.

Known limitations

  • In the two-columns history layout, the details panel may be narrower than the local changes view's minimum width.
  • The details panel's top-right buttons (open as standalone / collapse) overlap the top-right corner of the embedded local changes view.

Tested

  • Toggle the option on/off from the graph menu; check that other open repository tabs update when shown again
  • Node rendering with HEAD at the top, HEAD not at the top (newer branch above), detached HEAD
  • Select node → stage/unstage, diff, commit from the details panel
  • Select node + commit → compare with worktree
  • Commit / stash / discard while the node is selected → HEAD gets selected
  • Merge/rebase in progress, branch filters, first-parent only, bare repository
  • Vertical and two-columns layouts
  • Switch UI language at runtime → node label is updated

Add a `Local changes as graph node` option (in the graph advanced options
menu, disabled by default). When enabled and the working copy has changes,
a pseudo commit is inserted at the top of the history, linked to HEAD with
a dashed line.

- Selecting the node shows the full local changes view (stage, diff, commit)
  in the details panel
- Selecting the node together with a commit compares that commit with the
  worktree
- Context menu on the node: stash, discard all changes, open in the Local
  Changes page; double-click opens the Local Changes page
- When the node disappears (commit, stash, discard) while selected, the
  current HEAD gets selected
- Add translations for all locales

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@pitetb
pitetb changed the base branch from master to develop October 28, 2026 08:30
@tib8

tib8 commented Oct 28, 2026

Copy link
Copy Markdown

Oh I did almost the same #2816

@pitetb

pitetb commented Oct 28, 2026

Copy link
Copy Markdown
Author

One or another, I'm fine as it's merged!...

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants