Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

How do I do "blame" on a file in SourceTree

Tom Quarendon November 14, 2013

A very common operation that I want to do is work out how a file got to the state it is, who is responsible for that ghastly piece of code.

However I can find no way of doing this in SourceTree (Windows version 1.3.1.0).

Since it has no normal tree view of the working copy I can't just find the file, right click and say "blame" like I would expect.

I've naively tried using the search tab and typing in the source name and selecting the "File Changes" from the search type drop down. However it just sits forever thinking.

Is there a way to do what I want?

Thanks.

4 answers

1 accepted

0 votes
Answer accepted
Tom Quarendon December 1, 2013

Seems like you can't

4 votes
Jeff Thomas
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
November 14, 2013

There is a "Blame Selected" option when right-click on a file (if you can find it). I think your first problem is trying to figure out why searching hangs. Does it do this with every repository or just this one?

PatrikGrmanAnritsu April 23, 2019

Where is the Blame Selected option?

I found my file under Working copy and the only "<something> Selected" options I can see are "Log" and "Annotate"

Yes I know this is over 5 year old thread, but this is where search got me.

Like Denise Skidmore likes this
Like # people like this
3 votes
Chris Loverich March 5, 2014

The problem is the default view is only for modified files - however *you can change the view to show all files*. Its just as bit cludgy.

First, change the view to "File Status View" (on OSX, View --> File Status View)

Then, there is a selection menu on the actual app. Hard to describe, but its a menu bar beneath the icons menu bar, grouped with a few others:

Flat View | Tree View || Column View | *Show ... *

The "Show" selection can be changed to "Show All" - when I set mine, it was on "Show Modified"

Would probaly make more sense to have that option in the View menu proper.

Damian “dbirdz” Vogel August 14, 2018

This description is pure gold! If I was missing one thing, it was the tree view, you have just boosted the usefulness of this application by a 150%!

Like John_Mills likes this
0 votes
Tom Quarendon November 14, 2013

By "If you can find it", presumably you mean "if you can find the file somewhere in the user interface to have something to click on". And that's the basic issue. I know where the file is in my source tree, I just can't get an object anywhere in the UI to represent it, to have a context menu to select "blame selected" on. The only way I know is if I can find some commit under which it has changed, but almost by definition I don't know that in this scenario.

I'm not even sure "search file changes" is what I want. I've just tried on another repository cloned off an open source project and what I get in "Search: File changes" is, well I don't know what to be honest. It's a bunch of descriptions, dates, authors and commit hashes, but it's unclear to what files they relate. If I pick one, the files under the commit details aren't anything related to the term I put in the search dialog. Ahh. The diff to one of the files does contain the text I searched for. OK clever, but actually not at all what I'm after. Can't actually think of a scenario in which I'd want that. Now a "search the names of files in the working copy" would be a useful feature.

Perhaps our repository is just too big for the search? It's not small, but it's hardly enormous.

This is such a basic requirement to me that I'm surprised it's so hard. There must be a way of doing a blame or a log on an arbitrary file. I can do it simply using the git-gui windows integration, but I was hoping for a single gui, rather than using git-gui for some things and SourceTree (or something else) for others.

Jeff Thomas
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
November 16, 2013

You're right, I tried using the Search file changes and couldn't easily find the file I wanted. Unfortunately, I don't know of a better way to search in SourceTree. Hopefully someone else can comment.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events