Repository navigation
Conversation
[Medium impact] The PR appears safe to merge; the previous unsafe retry is blocked, and no new actionable issues were found.
|
When checking out a local branch, a commit, or a new local branch that tracks a remote branch fails because uncommitted changes would be overwritten, the alert used to have only an OK button. It now offers "Discard Changes and Continue", which runs the same checkout again with kGCCheckoutOption_Force like "git checkout -f": uncommitted changes to tracked files are reverted, including in submodules, untracked files that are in the way are overwritten, and other untracked files are kept. The button is destructive, is not triggered by Return, and the alert warns that this cannot be undone. Other checkout errors are presented as before. Submodules are updated after HEAD has moved, so when only a submodule blocks the checkout, HEAD has already changed by the time the conflict is reported. A retry could then not be undone back to the previous HEAD, so in that case the error is presented as before. The new tests build GCLiveRepository+Utilities.m and GIAppKit.m in the Tests target. GCLiveRepository+Utilities.h is not a public header and the Tests target builds without the AppKit part of GitUpKit.h, so a small header in Extensions/TestHeaders provides it to that target only.
NikKovIos
force-pushed
the
feature/discard-changes-on-checkout
branch
from
October 29, 2026 14:32
aec3de9 to
dcfe062
Compare
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.
Problem
When you check out a branch or a commit and uncommitted changes would be overwritten, GitUp only shows "Local changes would be overwritten by checkout" with an OK button. To switch anyway you have to discard or stash the changes yourself and then start the checkout again.
Changes
kGCCheckoutOption_Force, likegit checkout -f:GCLiveRepository+Utilities.m, the header is unchanged.Screenshots
Before
After
Tests
New
GitUpKit/Extensions/GCLiveRepository+Utilities-Tests.mwith 8 tests on a temporary repository:The tests record sheet alerts by swapping
-[NSAlert beginSheetModalForWindow:completionHandler:]for the duration of each test. The Tests target now also buildsGCLiveRepository+Utilities.mandGIAppKit.m. That header is not public and the target builds without the AppKit part ofGitUpKit.h, so a small header inExtensions/TestHeadersprovides it to the Tests target only.The full
GitUpKit (macOS)suite runs 104 tests. Locally,testClone(needs SSH access to GitHub) andtestDateFormatting(depends on the current date) fail, the same way as onmaster.Testing
Applicationscheme, Debug).I AGREE TO THE GITUP CONTRIBUTOR LICENSE AGREEMENT