Repository navigation
feat: ask before a hard reset, deleting a branch with unique commits, a force push or dropping a stash - #15
Merged
Merged
Conversation
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this changes
GitCraft now asks before anything that throws work away for good, and says what will be lost:
git branch -dwould refuse).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_changenow 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 warningsandcargo test --workspacepassIt 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)