git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [RFC] Add warning when git discard changes on another branch?

From
YRYubin Ruan <ablacktshirt@gmail.com>
Date
May 8, 2017, 12:27 UTC
Message-ID
<20170508122705.GB3540@HP>
In-Reply-To
<xmqqlgq89dzl.fsf@gitster.mtv.corp.google.com>
On Mon, May 08, 2017 at 01:19:58PM +0900, Junio C Hamano wrote:
Show 20 quoted lines
> Junio C Hamano <gitster@pobox.com> writes:
> 
> > But to help "some users are not aware of this" situation, an opt-in
> > "feature" would not help all that much.  The same number of lines in
> > the documentation to tell end-users how to toggle on such a "safety"
> > feature can be spent to teach them that their local changes in the
> > working tree do *not* belong to any particular branch, and as soon
> > as it is understood, the user would be OK.
> >
> > So...
> 
> It might help if we treat this similarly to how we treat the
> "detached HEAD" state.  By default when you do "git checkout HEAD^0"
> (not "git checkout --detach HEAD"), you would get a large warning,
> which you can silence by the advice.detachedhead configuration.  In
> addition to the list of "these paths have local modifications" that
> we show as a reminder, perhaps you want to show a warning that tells
> the user that the local modifications in these paths are not
> recorded anywhere else, or somesuch, and silence it with a new
> advice.* variable?

That would be helpful. But, frankly, if a user would be aware of that `advice.*' variable, he would have enough knowledge of Git to be aware of that situation. So, I think that 'M lala.txt' in transitions from branch to branch would be sufficient.

--- Yubin

Previous: Junio C HamanoNext: Junio C Hamano
Message 7 of 9 in “[RFC] Add warning when git discard changes on another branch?”
  1. Yubin RuanMay 7, 2017
  2. Junio C HamanoMay 8, 2017
  3. Yubin RuanMay 8, 2017
  4. Junio C HamanoMay 8, 2017
  5. Yubin RuanMay 8, 2017
  6. Junio C HamanoMay 8, 2017
  7. Yubin RuanMay 8, 2017
  8. Junio C HamanoMay 8, 2017
  9. Yubin RuanMay 8, 2017

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.