From 8c74e710b21893ee85d36ac876642bf29b1bfe63 Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Sun, 31 Mar 2024 16:21:28 +0300 Subject: [PATCH] feat: turn of advice about detached head Previously, every run log would contain: Note: switching to 'HEAD^'. You are in 'detached HEAD' state. You can look around, make experimental changes and commit them, and you can discard any commits you make in this state without impacting any branches by switching back to a branch. If you want to create a new branch to retain commits you create, you may do so (now or later) by using -c with the switch command. Example: git switch -c Or undo this operation with: git switch - Turn off this advice by setting config variable advice.detachedHead to false HEAD is now at 2d0d98e feat: add branch or patch information to run log This should now be gone. Signed-off-by: Lars Wirzenius --- src/run.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/run.rs b/src/run.rs index a61b1f6..350d333 100644 --- a/src/run.rs +++ b/src/run.rs @@ -176,6 +176,7 @@ impl Run { } fn git_checkout(&mut self, commit: Oid, src: &Path) -> Result<(), RunError> { + self.runcmd(&["git", "config", "advice.detachedHead", "false"], src)?; self.runcmd(&["git", "checkout", &commit.to_string()], src)?; Ok(()) }