Skip to content

fix: make commit update detached HEAD#2276

Merged
jcubic merged 1 commit intoisomorphic-git:mainfrom
Andarist:fix/detached-commit
Jan 25, 2026
Merged

fix: make commit update detached HEAD#2276
jcubic merged 1 commit intoisomorphic-git:mainfrom
Andarist:fix/detached-commit

Conversation

@Andarist
Copy link
Copy Markdown
Contributor

@Andarist Andarist commented Jan 25, 2026

I'm fixing a bug or typo

  • squash merge the PR with commit message "fix: [Description of fix]"

This matches the git's behavior.

Summary by CodeRabbit

  • Bug Fixes
    • Fixed commit handling to properly support detached HEAD state, ensuring HEAD updates correctly when making commits in this scenario.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Jan 25, 2026

📝 Walkthrough

Walkthrough

The pull request adds support for making commits in a detached HEAD state. The implementation detects when the repository is in detached HEAD mode and directly updates the HEAD reference instead of updating a branch pointer. A new test case validates this behavior.

Changes

Cohort / File(s) Summary
Detached HEAD state handling
src/commands/commit.js
Introduces logic to detect detached HEAD state by reading the HEAD reference. When in detached HEAD state, the commit reference is updated directly to HEAD instead of to a branch pointer.
Test coverage for detached HEAD
__tests__/test-commit.js
Adds a new test case that verifies the commit operation correctly updates HEAD when the repository is in detached HEAD state, ensuring the new commit becomes the current HEAD with proper parent linkage to the original HEAD commit.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 A detached HEAD hops so free,
No branch to bind, just HEAD you see,
Our commit lands where it should be,
Hopping direct, as wild as can be! 🌟

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: fixing the commit command to properly update HEAD when in detached HEAD state.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@jcubic
Copy link
Copy Markdown
Member

jcubic commented Jan 25, 2026

Looks good

@jcubic jcubic merged commit f87ef9a into isomorphic-git:main Jan 25, 2026
8 of 9 checks passed
@isomorphic-git-bot
Copy link
Copy Markdown
Member

🎉 This PR is included in version 1.36.3 🎉

The release is available on:

Your semantic-release bot 📦🚀

@jcubic
Copy link
Copy Markdown
Member

jcubic commented Jan 25, 2026

Thanks for the fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants