You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
warn user when trying to commit with detached HEAD #788
When I checkout into a detached HEAD state, Git gives me a heads up about where I'm ending up and what I can do:
Note: checking out '7ada1c16d50d746e56612085'.
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 performing another checkout.
If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:
git checkout -b <new-branch-name>
HEAD is now at 7ada1c1... Change 2
I'm thinking that it's okay for users to go ahead and make commits without warning them. The moment we should consider warning the user is when they try to switch out of the detached HEAD state (via switching to a branch.) We could let them know that they will potentially lose X number of commits and prompt them to create a branch to save their changes (or discard if they don't.)
Activity
donokuda commentedon Jan 11, 2017
Detached HEADalways sounds so gruesome 💀When I checkout into a detached HEAD state, Git gives me a heads up about where I'm ending up and what I can do:
I'm thinking that it's okay for users to go ahead and make commits without warning them. The moment we should consider warning the user is when they try to switch out of the detached HEAD state (via switching to a branch.) We could let them know that they will potentially lose X number of commits and prompt them to create a branch to save their changes (or discard if they don't.)
shiftkey commentedon Mar 22, 2018
Bumping this because the current UI still shows
masteras the branch you're going to commit toWarn when committing on a detached HEAD
Warn when committing on a detached HEAD
Warn when committing on a detached HEAD