Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

warn user when trying to commit with detached HEAD #788

Open
shiftkey opened this issue Jan 11, 2017 · 2 comments
Open

warn user when trying to commit with detached HEAD #788

shiftkey opened this issue Jan 11, 2017 · 2 comments
Labels
enhancement not-planned Not in the team's roadmap

Comments

@shiftkey
Copy link
Member

In case the user is in the detached HEAD scenario, we should warn the user in case they try to commit, and help them get back to a safe state.

xref #786 (comment)

@donokuda
Copy link
Contributor

Detached HEAD always 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:

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

@shiftkey
Copy link
Member Author

Bumping this because the current UI still shows master as the branch you're going to commit to

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement not-planned Not in the team's roadmap
Projects
None yet
Development

No branches or pull requests

4 participants
@shiftkey @sergiou87 @donokuda and others