Feature request: Ability to edit existing tag's message
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.
Quoted 19 lines · Eyal Rozenberg
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_namewould 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
--editsince the switch already exists, but if you like a different bikeshed then it could be --amend like git commit --amend.
Quoted 6 lines
Just my 2 cents and have a nice day,
Eyal RozenbergPS - 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.