Is there git blame gui similar to bzr qannotate?
Asked Answered
B

7

25

As a former bzr user and novice to git I'm trying to find good GUI tool for git blame similar to bzr qannotate. The latter has 2 major views:

  1. file content viewer with short annotate information (who, in which revision changed the line) + coloring of background based on committer id and age of the change.
  2. file log viewer: when I click on the line in file content I can see the revision when that line was changed and all log information about it.

Screenshot: enter image description here

I see XCode IDE has such something like that built-in, although it's inside editor window and therefore is not very handy.

So far I've tried GitX 0.7.1, and GitHub for Mac - they both don't have "blame" at all.

I've just checked SourceTree for Mac, and while it has blame support, but it's rather rudimental and shows me almost the same as command-line git blame, although I can double click the line to see corresponding revision and changes in another window. That's still is not as good as bzr qannotate.

Are there another GUI tools I can use?

Bradeord answered 21/11, 2012 at 9:54 Comment(2)
Hi bialix! It's been a long time! Unfortunately, I don't think there is anything as good as QBzr for git. :-( You guys had an excellent set of tools. I constantly crave the equivalent for Git.Czardom
You could also look at Tower, although it's pricey.Shelter
J
4

Check out Git Extensions and see if that's what you're looking for.

Jilolo answered 4/6, 2013 at 20:52 Comment(2)
And how exactly does one access the blame view in it?Denounce
One should note this tool is built for Windows only. It is not intended for Linux or Mac. There are some old, not-detailed build instructions for Linux for an old version of it here, but as a Linux user I'm not even going to attempt it, as I suspect it would be a never-ending rabbit hole of problems. There are other options I can use, such as my basic git blametool wrapper I wrote around git blame in my eRCaGuy_dotfiles repo in the "useful_scripts" dir.Kef
A
13

tig FTW!

Pressing t you get the tree view. Then, pressing B shows you the git blame of the highlighted file.

Avruch answered 21/11, 2012 at 23:1 Comment(0)
F
8

The easier way could be git gui blame <arguments>. You can use git gui --help for more information about the arguments. Here the official source

Facelifting answered 28/2, 2017 at 8:11 Comment(0)
J
4

Check out Git Extensions and see if that's what you're looking for.

Jilolo answered 4/6, 2013 at 20:52 Comment(2)
And how exactly does one access the blame view in it?Denounce
One should note this tool is built for Windows only. It is not intended for Linux or Mac. There are some old, not-detailed build instructions for Linux for an old version of it here, but as a Linux user I'm not even going to attempt it, as I suspect it would be a never-ending rabbit hole of problems. There are other options I can use, such as my basic git blametool wrapper I wrote around git blame in my eRCaGuy_dotfiles repo in the "useful_scripts" dir.Kef
S
3

git gui has this functionality, but it's not nearly as polished. Go to "Repository" -> "Browse master's files" (or "Browse Branch files" for a different branch) -> double click on a file name. It's basic, and doesn't seem to have a lot of configurability at this point, but it's functional.

Sexagesima answered 21/11, 2012 at 22:52 Comment(2)
Or in gitk (that comes with msysgit at least) right click on a line in the diff view and choose "Show origin of this line"Filide
@Filide What a great feature. msysgit comes with Sourcetree. Thanks.Catch
K
2

git blametool

I wrote a simple wrapper around git blame which works pretty well. I call it git blametool. Get it in my eRCaGuy_dotfiles repo here. Calling git blametool opens up the git blame output in your "blametool" of choice--which can be any text editor. Examples of text editors include: vim, emacs, gedit, nano, Sublime Text 3 (subl, the default, and my preferred choice), etc.

Installation

For the latest installation instructions, see the comments inside the top of git-blametool.sh itself. There are many ways to do this, but here are some possible installation instructions:

mkdir ~/dev  # make development dir
cd ~/dev
git clone https://github.com/ElectricRCAircraftGuy/eRCaGuy_dotfiles.git
cd eRCaGuy_dotfiles/useful_scripts
# make symbolic link to "git-blametool.sh" inside ~/bin
mkdir -p ~/bin 
ln -si "${PWD}/git-blametool.sh" ~/bin/git-blametool

Close and re-open your terminal. Assuming ~/bin is part of your PATH (it is on Ubuntu by default if you create the ~/bin dir and then log out and log back in), now you have access to git-blametool, which can be run simply as git blametool.

Run git blametool -h for the full help menu.

Set your blametool editor (see git blametool -h for details):

# set your blametool editor as Sublime Text 3 (its command-line executable is 'subl'):
git config --global blametool.editor subl

# see what your current setting is
git config --global blametool.editor

# Other popular choices to set as your blametool editor:
git config --global blametool.editor vim
git config --global blametool.editor emacs
git config --global blametool.editor nano
git config --global blametool.editor gedit
git config --global blametool.editor leafpad
git config --global blametool.editor code # VSCode

Get Sublime Text 3 if you don't have it: https://www.sublimetext.com/3.

Install the Git plugin so you get "git blame" syntax highlighting: Ctrl + Shift + P --> "Package Control: Install Package" --> type in "Git" and choose that package.

Usage

Now run git blametool! It's a wrapper around git blame so it accepts any options that git blame accepts!

Example usage:

git blametool -h  # help menu
git blametool somefile.c
git blametool somebranch somefile.c

Demo

Inside my eRCaGuy_dotfiles repo that you just cloned above, run:

git blametool useful_scripts/git-diffn.sh

You'll see something like this: enter image description here

Let's drill down deeper. On line 8 I see commit hash 68e96491, so I double-click on it in Sublime Text and copy it. Now I can run this in my terminal:

git blametool 68e96491 useful_scripts/git-diffn.sh

And now I see: enter image description here

Notice there are 2 tabs open in Sublime Text 3 now, each showing the commit hash from the git blame as part of the file name. I want to dig deeper, so I copy the hash from the first line and run:

git blametool c294f965 useful_scripts/git-diffn.sh

It opened up this git blame into a 3rd tab in Sublime Text 3. Now I see this: enter image description here

I can easily click around the 3 tabs. Cool. Now imagine I found what I was looking for, so to see a side-by-side comparison I run this to look at the comparison between commit hash c294f965 and 68e96491 in meld:

git difftool 68e96491 68e96491 useful_scripts/git-diffn.sh

And here's what I see: enter image description here

If you don't have meld set up, follow my instructions in my answer here: Git mergetool with Meld on Windows.

Alternatives to git blametool

Here are a few alternatives:

  1. GitHub
    1. Just navigate to a file in a repo on GitHub and click on the "Blame" link as shown here: enter image description here.
    2. You'll now see a nice git blame view in GitHub like this. Notice you can click on these funky window icon things to go back farther into the git blame history: enter image description here. Clicking on the one in the picture above, for instance, would be like running git blametool 68e96491 useful_scripts/git-diffn.sh, since the git blametool output for that line shows 68e96491 is its commit hash.
  2. "Git Blame" Sublime Text 3 package. I like my git blametool better, but this is an option too:
    1. https://packagecontrol.io/packages/Git%20blame
    2. https://github.com/frou/st3-gitblame

See also

  1. VERY USEFUL! View the edit history of a single file!
    git log -p somefile.c
    
    Inspired by: How can I view prior commits with git blame?
  2. [my answer] Git mergetool with Meld on Windows

Keywords: git blametool; open git blame in the editor of your choice

Kef answered 2/3, 2021 at 5:7 Comment(0)
M
1

Aptana Studio, SublimeText and TextMate have similar visualisations to what you have there, but nothing with colors. You can configure emacs or vim to show you a coloured version.

Movable answered 21/11, 2012 at 12:2 Comment(0)
K
1

A little bit late, but GitKraken supports history and blame very well.

Knap answered 1/12, 2017 at 1:26 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.