GitVersion icon indicating copy to clipboard operation
GitVersion copied to clipboard

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

Open rcdailey opened this issue 3 years ago • 0 comments

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.
  • Version Used: 5.10.1
  • Operating System and version (Windows 10, Ubuntu 18.04): Windows 10 x64
  • Link to your project: https://github.com/recyclarr/recyclarr

rcdailey avatar May 22 '22 16:05 rcdailey