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 }}
This repository was archived by the owner on Dec 15, 2022. It is now read-only.
Repository navigation
This repository was archived by the owner on Dec 15, 2022. It is now read-only.
If a user attempts to change to a branch after making one or more detached commits, provide some kind of "are you sure?" prompt to prevent "lost" work. Suggested by @BinaryMuse in #533.
What's the best way to determine that detached commits are present? I'm guessing that there's a git porcelain command to discover if HEAD is reachable from any refs/heads.
I generally favor avoiding modal dialogs when possible, as they're disruptive UX. Maybe instead of a modal prompt, we could display a notification with a control that checks out the detached commit's ref again? Then again maybe "not losing your work" is a reasonable time to be disruptive.
What language should we use in the prompt? When I was doing Handle repositories with no commits #533 I avoided any "detached HEAD" wording in user-facing text because it's one of the top sources of confusion and anxiety among new git users (back when I was teaching git, it was one of my favorite examples of user-hostile error messages 😉).
"detached HEAD"? Hmm.. please no gifs in this issue. 🙈
You're in "Git limbo" 😬
Or just "you're not on a branch"
Maybe we can still use the "detached HEAD" term so that you can search for it if you want to know more. But just describe what it means and take away the fear.
If a user attempts to change to a branch after making one or more detached commits, provide some kind of "are you sure?" prompt to prevent "lost" work.
What about giving users an option how to "get out of it". Like "There are commits not part of a branch (detached HEAD) and will be hard to find later. Would you like to create a new branch? [Create new branch] [Checkout other-branch]". The "Create new branch" button would open the tooltip (not sure if it can be opened programmatically).
Or how about warn before making a commit in a detached HEAD? I guess most of the time people just forgot to checkout/create a branch. "You're currently not on a branch (detached HEAD) and this commit will be hard to find later. We suggest creating a branch first. [Create branch] [Commit]".
Automatically create a branch? Goes against the Git purists, but is there a use case where committing to a detached HEAD is desired?
Activity
simurai commentedon Mar 1, 2017
"detached HEAD"? Hmm.. please no gifs in this issue. 🙈
Maybe we can still use the "detached HEAD" term so that you can search for it if you want to know more. But just describe what it means and take away the fear.