lazygit icon indicating copy to clipboard operation
lazygit copied to clipboard

Support deleting and/or rewriting tags

Open fredcallaway opened this issue 2 years ago • 3 comments

As far as I can tell, there's no way to move a tag from one commit to another within lazygit. I think this would be a nice feature which could be accomplished in a few ways.

  1. Opening the T menu on a commit that already has a tag includes an option to delete the tag.
  2. tags are always created with the -f option (which will move the tag if it existed before)
  3. when trying to use an existing tag, a dialogue box appears asking the user if they'd like to move the tag from the other commit.

I don't think 2 is a good idea, but including for completeness. 1 and 3 might both be nice actually.

fredcallaway avatar Dec 16 '22 23:12 fredcallaway

I wanted this feature today... I realize that not having this functionality could be considered a feature, since tags should in general not be changed, especially if they've been pushed. However, same goes with rebasing and editing commits; if you are using lazygit you have in some sense already tapped the map and said "I solemnly swear I am up to no good".

So then, I am in favor of option 1, maybe 3 as a nice-to-have. Since deleting tags is lossy and inadvisable as I mentioned, if you select that menu item it could come up with another "deleted tags are unrecoverable! don't do this if you have pushed. continue? y/n" prompt before doing it.

durka avatar Apr 14 '23 19:04 durka

I have a branch that implements option 3. I like that best, as it is similar to what happens when you try to push a branch that needs to be force-pushed. I use the feature frequently, as I often work with short-lived throw-away tags (e.g. "before-rebase"). I implemented it only for light-weight tags, as I think annotated tags should never be moved.

This is one of the many things that I didn't get around to making a PR for yet. It's on my list...

stk-ableton avatar Apr 14 '23 19:04 stk-ableton

BTW, tags can already be deleted, just not from the commit that they are pointing at. You need to go to the Tabs panel and find the tag there, then hit "d" to delete it.

stk-ableton avatar Apr 14 '23 19:04 stk-ableton