Skip to content

feat: ask before a hard reset, deleting a branch with unique commits, a force push or dropping a stash - #15

Merged
Lars- merged 3 commits into
mainfrom
feat/confirm-destructive
Nov 2, 2026
Merged

Lars- merged 3 commits into
mainfrom
feat/confirm-destructive

Conversation

@Lars-

@Lars- Lars- commented Nov 2, 2026 •

Copy link
Copy Markdown
Owner

What this changes

GitCraft now asks before anything that throws work away for good, and says what will be lost:

  • Hard reset from the graph: "Hard reset main to 1a2b3c4, throwing away every uncommitted change?"
  • Deleting a branch asks only when no other branch, remote branch or tag has all of its commits ("Delete topic and the 1 commit on no other branch or tag?"). A branch that is merged anywhere, or pushed, goes without a question, also when it is not merged into the current branch (where git branch -d would refuse).
  • Force push: when the current branch went its own way since the last push (ahead and behind, after an amend or a rebase), Push offers to force push with a lease, so commits someone else pushed since the last fetch are never overwritten.
  • Dropping a stash asks first too.

This is the first item under "Next" in the roadmap; the README no longer warns about hard resets.

How it is tested

  • Core (crates/core/tests/repo.rs): counting the commits only a branch has (tags, remote branches and a branch with a similar name keep them), deleting such a branch, and a force push after an amend that goes through, plus one the lease refuses after someone else pushed.

  • App (crates/app/src/tests.rs), through right-click menus and the toolbar like a user: hard reset (cancel keeps the work, Reset discards it), deleting a merged and an unmerged branch, force pushing a diverged branch to a real remote, and dropping a stash.

  • stage_and_commit_a_change now waits for a reload the watcher may start right after opening, as the other tests do (it tripped over that once on macOS here).

  • Tried in the app on Linux: each question shows, Cancel and Escape leave everything as it was, and going ahead does what it says.

  • cargo fmt --all, cargo clippy --workspace --all-targets -- -D warnings and cargo test --workspace pass

  • It adds as little code as the change needs, and removes what it makes unnecessary

  • Nothing in it comes from GitKraken or another closed-source client (see CONTRIBUTING.md)

@Lars-
Lars- merged commit 325d178 into main Nov 2, 2026
7 checks passed
@Lars-
Lars- deleted the feat/confirm-destructive branch November 2, 2026 10:25
@Lars- Lars- mentioned this pull request Nov 2, 2026
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.

1 participant