Skip to content
This repository was archived by the owner on Dec 15, 2022. It is now read-only.
This repository was archived by the owner on Dec 15, 2022. It is now read-only.

Prompt when abandoning a detached commit #576

Open

Description

@smashwilson

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 😉).

Activity

  1. simurai commented on Mar 1, 2017

    @simurai
    Contributor

    "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?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions