26

I would like to list the available tags in Magit in order to diff a specific revision, is this possible?

Specifically what I am after is to list the revision history at a certain tag and then view the diff for one of the patches in its history. I have just completed a rebase and noticed some inconsistencies, I know which patch introduced the change and I would like to see its diff from the version prior to the rebase.

1
  • 2
    Not a very robust way, but will work for the lack of better options: : tag - : will execute git with the given argument and git tag will just print the list of all tags.
    – wvxvw
    Jan 21, 2015 at 8:54

2 Answers 2

11

Specifically what I am after is to list the revision history at a certain tag

It sounds like you already know the tag you need, in which case:

Magit 1.x:
lrl type tag name (with TAB completion) RETRET

Magit 2.x:
lo type tag name (with TAB completion) RET

I have just completed a rebase and noticed some inconsistencies

Or use the reflog to find the pre-rebase hash:

Magit 1.x:
lrh

Magit 2.x:
lORET

0
32

I would like to list the available tags in Magit ...

Type y to show a buffer which lists branches, remote branches, and, at the bottom, tags.

...in order to diff a specific revision [reachable from that tag]

Move to the tag and press loRET. That shows the log for that tag. Move to the commit and press RET. That shows information about that commit, including the diff.

You don't necessarily have to move to the tag first to show the log for it. You can also type lo<TAGNAME>RET.

3
  • The list of tags was too long and distracting for me too see every time I hit y, so I configured the magit-refs-sections-hook variable to take it out. Is there another way to explicitly list all the tags? Oct 10, 2018 at 19:24
  • 1
    Instead of removing the tag section you can just configure it to be hidden by default, see magit-section-initial-visibility-alist.
    – tarsius
    Oct 10, 2018 at 21:50
  • Thanks, seems to work great (I added remote and tags to that list). Also nice that it remembers the last open/closed state. Oct 11, 2018 at 1:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.