git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Feature request: Ability to edit existing tag's message
@ 2021-11-12 15:05 Eyal Rozenberg
  2021-11-12 16:08 ` Ævar Arnfjörð Bjarmason
  0 siblings, 1 reply; 2+ messages in thread
From: Eyal Rozenberg @ 2021-11-12 15:05 UTC (permalink / raw)
  To: git

At the moment, one has to go through some hoops to edit a tag's message;
see discussions here:

https://stackoverflow.com/q/7813194/1593077

It would be nice if:

    git tag --edit my_tag_name

would bring up the editor with the existing text of my_tag_name's
message, for amendment. And, perhaps,

    git tag --edit my_tag_name -m "new message"

would overwrite the existing message. I've suggested `--edit` since the
switch already exists, but if you like a different bikeshed then it
could be --amend like git commit --amend.


Just my 2 cents and have a nice day,
Eyal Rozenberg


PS - I'm not on this mailing list, so if you want to reply, please use
my actual address.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Feature request: Ability to edit existing tag's message
  2021-11-12 15:05 Feature request: Ability to edit existing tag's message Eyal Rozenberg
@ 2021-11-12 16:08 ` Ævar Arnfjörð Bjarmason
  0 siblings, 0 replies; 2+ messages in thread
From: Ævar Arnfjörð Bjarmason @ 2021-11-12 16:08 UTC (permalink / raw)
  To: Eyal Rozenberg; +Cc: git


On Fri, Nov 12 2021, Eyal Rozenberg wrote:

> At the moment, one has to go through some hoops to edit a tag's message;
> see discussions here:
>
> https://stackoverflow.com/q/7813194/1593077
>
> It would be nice if:
>
>    git tag --edit my_tag_name
>
> would bring up the editor with the existing text of my_tag_name's
> message, for amendment. And, perhaps,
>
>    git tag --edit my_tag_name -m "new message"
>
> would overwrite the existing message. I've suggested `--edit` since the
> switch already exists, but if you like a different bikeshed then it
> could be --amend like git commit --amend.
>
>
> Just my 2 cents and have a nice day,
> Eyal Rozenberg
>
>
> PS - I'm not on this mailing list, so if you want to reply, please use
> my actual address.

Yes, these should be an easier way to do that.

In the meantime it seems a lot of those suggestions on Stack Overflow
are way too complex, since they're struggling to maintain all the tag
metadata as-is, an easier way is:

    git cat-file tag <tag-name> | sed s/foo/bar/g | git mktag

Which will create and print out the OID of a tag object, if nothing is
changed the OID is the same, then just:

    git tag <tag-name> <that-oid>

Where you'll need a --force if the <tag-name> is the same.

It's not as "safe" as e.g. "git commit --amend", as you can edit the raw
headers, but for people who want this that may be a feature most of the
time.

It will also preserve the inline PGP signature, which if you make any
edits to the tag won't verify anymore.

It also looks like a lot of those SO answers pre-date my not-so-recent
changes to "fetch" where we'll by default error if any existing tags
would be clobbered.

So you can do this, but there's a reason for why it's not
implemented. I.e. you really don't want to edit existing tags in the
general case.

But I can see how it's useful if you've not pushed it out, or if
changing it is OK in your environment even if it was pushed out.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-11-12 16:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-11-12 15:05 Feature request: Ability to edit existing tag's message Eyal Rozenberg
2021-11-12 16:08 ` Ævar Arnfjörð Bjarmason

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).