Where is git-blame in SourceTree
Asked Answered
J

5

78

I'd like to see who contributed which line/change to a file. git-blame does exactly that. So does SourceTree have a git-blame view?

Jeanajeanbaptiste answered 14/5, 2012 at 10:45 Comment(2)
These answers are just as I suspected - if you're trying to do a "blame" for an arbitrary file, it can be hard to find the file in the interface. One (far from perfect) shortcut I use is to just temporarily modify the file to cause it to appear as an "Unstaged file", at which point I can right-click it to access the blame.Entrench
See Ted's answer (4th one). Sourcetree has cleaned up the language in version 3. We're not out to blame anyone, are we? We're just on a quest to understand. Not that we're getting much help. The windows that pops up with the result is not even searchable.Ludwigg
B
22

Starting sourcetree 3.0

Right click file > Annotate Selected

enter image description here

Brickle answered 11/11, 2018 at 17:58 Comment(2)
Someone indeed opened an issue for that.Stinkweed
Also pointed out by an Atlassian employee community.atlassian.com/t5/Sourcetree-questions/…Impress
S
90

Select a file, whether in the 'working copy' display or in the 'commit' display, and do one of three things:

  1. option-command-B
  2. menu bar :: Actions :: Blame Selected...
  3. contextual menu :: Blame Selected...

If the file you want to blame is not in the modified files list, you need to change the view to File Status View (View --> File Status View), then set the Sub menu to "Show All"

Show All on OSX

Sophisticate answered 14/5, 2012 at 15:26 Comment(3)
Not sure what you are asking. A file changing since the last commit doesn't impact the blame (as the blame is based on the past commits). If the file hasn't change then in Source-Tree you'll find it by selecting 'Working Copy' and then 'Show All' (not 'Show Pending'). From there you can see all the files and select the one you want the blame for.Sophisticate
Note that for some inexplicable reason, this has changed from "Blame Selected" to "Annotate Selected"Entrench
It seems like "Blame" and "Annotate" are near synonyms (for some spelunking on that, see this post on the git mailing list). I'm also suspecting some political correctness being injected.Piperonal
B
22

Starting sourcetree 3.0

Right click file > Annotate Selected

enter image description here

Brickle answered 11/11, 2018 at 17:58 Comment(2)
Someone indeed opened an issue for that.Stinkweed
Also pointed out by an Atlassian employee community.atlassian.com/t5/Sourcetree-questions/…Impress
E
11
  1. Switch to the history view and select a commit that has the file you would like to blame.
  2. Right-click the file name and select Blame Selected.

Alternatively, you can right-click a file in the working tree or that has been staged and do the same thing.

Evangelia answered 14/5, 2012 at 10:48 Comment(1)
It's been renamed to "Annotate" in newer versions...Impress
D
2

Right click the file-> Blame selected. You can find writer of Each line . Trick: Make a minor change like adding a space in the file you want to find the file easily(File Status) in Source tree.

Drennen answered 18/7, 2017 at 15:35 Comment(0)
I
-2

In german version:

  1. Modify the file so that it appears in the staging area.
  2. Right click
  3. Click on "Log für Auswahl..." (Log for selection...)
Inform answered 1/9, 2021 at 12:30 Comment(1)
"Log Selected..." and "Blame" are different thingsImpress

© 2022 - 2024 — McMap. All rights reserved.