Re: [RFC] Detached-HEAD reminder on commit?
- From
- Pieter de Bie <pdebie@ai.rug.nl>
- Date
- Sep 2, 2008, 21:51 UTC
- Message-ID
- <0578A0F2-F90A-4555-9B34-726F26A1CDBB@ai.rug.nl>
- In-Reply-To
- <20080902210524.GB7757@leksak.fem-net>
On 2 sep 2008, at 23:05, Stephan Beyer wrote:
Show 22 quoted lines
> Junio C Hamano wrote: >> Pieter de Bie <pdebie@ai.rug.nl> writes: >> > [..] >>> Vienna:git pieter$ ./git commit --allow-empty -m"test" >>> Created commit 6ce62c8b: test >>> You are on a detached head, so this commit has not been recorded >>> in a branch. >>> If you don't want to lose this commit, checkout a branch and then >>> run: >>> git merge 6ce62c8bfcfb341106f3587d1c141c3955c2544c >>> >>> Are there any comments to this / strong opinions against such a >>> change? >> >> Unconditionally doing this is too loud for my taste. You probably >> can do >> this in your post-commit hook. > > Well, Pieter probably can do this in his post-commit hook. But I think > this is useful for usability... especially for beginners who might not > even know what a hook is. ;)
Exactly..I can fix this for myself, and when things go wrong I can also fix it, but there are people less with Git that don't understand what's going on.
Show 5 quoted lines
> For me this felt too loud, too, especially since "git status" and > "git commit" (without message option) already tells the user that > she is on a detached HEAD. And "git commit -a" is usually done after > a "git status", too, isn't it? (I do not use "git commit -a", I *use* > the index.)
The one in "git status" is somewhat noticeable with color highlighting, but the "git commit" one doesn't exactly stand out:
# Please enter the commit message for your changes. Lines starting # with '#' will be ignored, and an empty message aborts the commit. # Not currently on any branch. # Untracked files: # (use "git add <file>..." to include in what will be committed)
It's the third line, surrounded by other lines and at the bottom of the window.
How about a single line then, something like
Vienna:git pieter$ ./git commit --allow-empty -m"test" Created commit 6ce62c8b: test Remember you are on a detached head, create a new branch to not lose these changes