Skip to content

[Bug] Builds fail due to detached HEAD during interactive rebase #3124

@rcdailey

Description

@rcdailey

Describe the bug

During interactive rebase, HEAD is detached and thus I am not able to build my project. I get the following error:

It looks like the branch being examined is a detached Head pointing to commit '5fa2336'. Without a proper branch name GitVersion cannot determine the build version.

Expected Behavior

Even though I understand the reasons why detached HEAD is not supported, I think it's important to somehow allow the build to succeed during interactive rebase.

Possible Fix

Maybe a temporary version number if REBASE_HEAD exists? It's not really important for version numbers to be accurate during a rebase. The build just needs to succeed for testing purposes.

Steps to Reproduce

  1. Create a branch with 2 commits on it
  2. Perform a git rebase -i origin/master
  3. For the first commit, change it from pick to edit
  4. When the rebase stops at that commit, perform a dotnet build, or compile with visual studio.

Context

The reason why builds are important during interactive rebase can be explained with this example:

  1. I perform an interactive rebase and stop at a specific commit (with edit) to fix an issue
  2. After fixing it, I want to build, run unit tests, and run the application for a quick smoke test. The idea is: At this specific commit, everything should "work" because it's possible to cherry-pick this commit later, or revert it, and it needs to work in isolation from my branch.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions