Make Git Bisect do a force checkout or otherwise overwrite local changes
Asked Answered
N

1

8

I'm git bisecting a Unity3D repository and every time I open the Unity3D editor to check if the current revision is good or bad, Unity3D dirties a few files, forcing me to do a hard reset before continuing with the bisection.

This is because if I don't reset, I'll get:

error: Your local changes to the following files would be overwritten by checkout:
        Platform/Assembly-CSharp.csproj
        Platform/ProjectSettings/ProjectSettings.asset
Please commit your changes or stash them before you switch branches.
Aborting

Is there any way to tell git bisect to use --force in its checkout call or otherwise avoid having to reset every single time?

Norvun answered 17/7, 2020 at 14:6 Comment(3)
I guess as workaround you could set a custom command alias (if on linux/unix) like e.g. alias gitbi='git reset --hard; git bisect, then you could use gitbi bad and gitbi good to tag the revisions (while automatically cleaning the repo before-hand so that the autom. checkout can succeed).Straightedge
@Straightedge That's not a bad idea. And one that simply didn't occur to me. If I don't get any better answers feel free to post that as an answer and I'll accept it.Norvun
Has anyone found a solution to this for git bisect run? It is quite annoying that this prevents automated running of git bisect.Fraternize
F
0

After reading the source code, there is not a built-in way to do this.

I've submitted a patch (github) that adds this feature, hopefully it makes it into a release.

Fraternize answered 15/1 at 7:15 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.