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

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

Seems like you can't

0 vote
Jeff Thomas Atlassian Team Nov 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?

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 Nov 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.

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.

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Brian Ganninger
Published Jan 23, 2018 in Sourcetree

Tip from the team: workflow and keyboard shortcuts

Supported Platforms macOS Sourcetree has a lot to offer and, like many developer tools, finding and using it all can be a challenge, especially for a new user. Everyone might not love ...

647 views 0 4
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you