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

Re: Feature request: Add --no-edit to git tag command

From
Jeff King <peff@peff.net>
Date
Apr 4, 2019, 12:01 UTC
Message-ID
<20190404120108.GA22324@sigill.intra.peff.net>
In-Reply-To
<xmqqo95mf80j.fsf@gitster-ct.c.googlers.com>
On Thu, Apr 04, 2019 at 06:13:16PM +0900, Junio C Hamano wrote:
Show 16 quoted lines
> >> Similar to git commit, it would be nice to have a --no-edit option for
> >> git tag. Use case is when I force-recreate a tag:
> >> 
> >> $ git tag -af 1.0 123abc
> >> 
> >> An editor will be prompted with the previous annotated tag message. I
> >> would like to add --no-edit to instruct it to use any previously
> >> provided message and without prompting the editor:
> >> 
> >> $ git tag --no-edit -af 1.0 123abc
> >
> > Yeah, that sounds like a good idea.
> 
> I am not so sure this is a good idea, especially if the plan is to
> do this alone without necessary associated change to make things
> consistent.
I think I may have misunderstood the request.

I thought it was "we already do this re-use the tag message thing, but --no-edit is broken". And the proposal was to fix --no-edit. Which is definitely broken, and it seems like a no-brainer to fix.

But looking at the code, yeah, I see that we do not do that. The proposal is to implement both halves. And...

Show 14 quoted lines
> The part that bothers me most is use of "-f".  The mentalitly behind
> "-f" is "I am creating a new and tag that is totally unrelated to
> any existing tag, but since the command refuses to reuse the ref to
> point at my new tag, I am giving an '-f' to force (1) unpointing the
> existing unrelated tag and (2) pointing the enwly created tag with
> that tagname".
> 
> The proposed change still uses "-f" but wants to somehow take the
> tag message from the unrelated tag that happens to sit at the same
> place as the new tag wants to go.  That breaks the mental model a
> big way.
> 
> If this were a new option that is spelled "--amend", I won't
> be complaining, though.

Yes, I agree with all of this. Calling it "--amend" is much better (and/or adding the equivalent of "commit -c" to pick up the message from an existing tag, though maybe "--amend existing-name new-target" would be enough to repoint a tag with the same name).

-Peff
Previous: Junio C Hamano
Message 13 of 13 in “Feature request: Add --no-edit to git tag command”
  1. Robert DaileyApr 3, 2019
  2. Jeff KingApr 4, 2019
  3. Taylor BlauApr 4, 2019
  4. Jeff KingApr 4, 2019
  5. Robert DaileyApr 4, 2019
  6. Robert DaileyApr 4, 2019
  7. Jeff KingApr 5, 2019
  8. Bárbara de Castro FernandesApr 11, 2019
  9. Jeff KingApr 11, 2019
  10. Junio C HamanoApr 12, 2019
  11. Jeff KingApr 12, 2019
  12. Junio C HamanoApr 4, 2019
  13. Jeff KingApr 4, 2019

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.