Skip to content

Conversation

@shabbir-sprinting
Copy link

This PR implements automatic stashing of local changes when marking commits as "good", "bad", or "skip" during a git bisect operation. If the working directory is not clean, changes are stashed before the bisect step and restored afterward. This improves usability and prevents bisect failures due to uncommitted changes.

This PR was AI-generated.

@love-linger
Copy link
Collaborator

Bisect is usually used to locate the commit that caused a known issue. Under normal circumstances, locally uncommitted code should not be included (as it may cause more interference). Therefore, this PR will not be added to SourceGit.

@love-linger love-linger self-assigned this Oct 13, 2025
@love-linger love-linger added the not-planned It's not planned in the future label Oct 13, 2025
@shabbir-sprinting
Copy link
Author

Under normal circumstances, locally uncommitted code should not be included

This is theoretically correct, but as the saying goes, “In theory, there is no difference between theory and practice. In practice, there is.” 🙂

In real-world enterprise repositories, best practices aren’t always followed. For instance, I work with a codebase where I need to maintain local modifications to several Git-tracked files so that the system connects to the correct database for the development environment.

Because of this setup, I’d like to be able to run git bisect without having to stash and reapply these local changes before and after each step.

@love-linger
Copy link
Collaborator

For instance, I work with a codebase where I need to maintain local modifications to several Git-tracked files so that the system connects to the correct database for the development environment.

I recommend using the post-check hook provided by git to do this.

For example:

#!/bin/bash

echo "Post-checkout hook executed"
echo "Old HEAD: $1"
echo "New HEAD: $2"
echo "Is branch checkout: $3"

@love-linger love-linger closed this Nov 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

not-planned It's not planned in the future

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants