git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
To: Eyal Rozenberg <eyalroz1@gmx.com>
Cc: git@vger.kernel.org
Subject: Re: Feature request: Ability to edit existing tag's message
Date: Fri, 12 Nov 2021 17:08:54 +0100	[thread overview]
Message-ID: <211112.86fss1uyxy.gmgdl@evledraar.gmail.com> (raw)
In-Reply-To: <04cbce68-bcbd-dbb2-5d9d-df7dd464fa03@gmx.com>


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.

      reply	other threads:[~2021-11-12 16:21 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=211112.86fss1uyxy.gmgdl@evledraar.gmail.com \
    --to=avarab@gmail.com \
    --cc=eyalroz1@gmx.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).