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

Re: [PATCH 1/2] Prevent force-updating of the current branch

From
Conrad Irwin <conrad.irwin@gmail.com>
Date
Aug 23, 2011, 19:20 UTC
Message-ID
<CAOTq_ptTsO01XvjMcBcWNaOQHvwm7cHP2AzSRpbSzox-NNj7Rg@mail.gmail.com>
In-Reply-To
<7v39gsrnuc.fsf@alter.siamese.dyndns.org>
On Tue, Aug 23, 2011 at 11:20 AM, Junio C Hamano <gitster@pobox.com> wrote:
Show 11 quoted lines
> Conrad Irwin <conrad.irwin@gmail.com> writes:
>
>> git branch -M <foo> <current-branch> could be used to change the branch
>> to which HEAD points, without the necessary house-keeping that git reset
>> normally does to make this operation sensible. It would leave the reflog
>> in a confusing state (you would be warned when trying to read it) and
>> had an apparently side-effect of staging the diff between <current branch>
>> and <foo>.
>
> The last two lines are redundant (it is "without the house-keeping of
> reset"); I'll remove "and had an apparently...".
That's fine by me.
Show 5 quoted lines
>> git checkout -f already guarded against this problem, and aborted with
>> a fatal error.
>
> I assume you mean "branch -f". I'll rewrite it so, and in the present
> tense.
Yes. Thank you.
Show 7 quoted lines
>
>> git branch -M, git checkout -B and git branch -f now use the same checks
>> before allowing a branch to be created. These prevent you from updating
>> the current branch.
>
> Looks good ;-). Also the patch looks good, too.
>
Glad to hear :).
Conrad
Previous: Junio C HamanoNext: Conrad Irwin
Message 4 of 5 in “Prevent force updating of the current branch”
  1. Prevent force updating of the current branchConrad Irwin, Aug 20, 2011
  2. 1/2 Prevent force-updating of the current branchConrad Irwin, Aug 20, 2011
  3. Junio C HamanoAug 23, 2011
  4. Conrad IrwinAug 23, 2011
  5. 2/2 Show interpreted branch name in error messagesConrad Irwin, Aug 20, 2011

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.