Check out Git Extensions and see if that's what you're looking for.
Is there git blame gui similar to bzr qannotate?
Question
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:
- 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.
- 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:
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?
Solution 4
OTHER TIPS
tig
FTW!
Pressing t you get the tree view. Then, pressing B shows you the git blame
of the highlighted file.
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
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.
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
# Other popular choices:
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
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:
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
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:
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
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:
- GitHub
- Just navigate to a file in a repo on GitHub and click on the "Blame" link as shown here: .
- 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 thegit blame
history: . Clicking on the one in the picture above, for instance, would be like runninggit blametool 68e96491 useful_scripts/git-diffn.sh
, since thegit blametool
output for that line shows68e96491
is its commit hash.
- "Git Blame" Sublime Text 3 package. I'll probably just stick to
git blametool
--I'm still yet to decide, but this is an option too.
See also
- VERY USEFUL! View the edit history of a single file!
Inspired by: Git blame -- prior commits?git log -p somefile.c
- [my answer] Git mergetool with Meld on Windows
Keywords: git blametool
; open git blame
in the editor of your choice