How can I find all versions of a file on some branch

David Jameson June 15, 2014

I'm working on one branch and there's a particular file on another branch that I'd like to pull in but I can't easily find the LATEST version of that file. I can sometimes find SOME version of it and when I do that and right-click to log, I see the history of that file up to the commit where I found it but that doesn't tell me if there's a newer commit of that file.

The "Find" mechanism doesn't seem to have a way to find an actual file by its name. It only seems to let you search by commit message, SHA and other such things.

What am I missing?

2 answers

1 vote
Balázs Szakmáry
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 16, 2014

First select the latest commit in the top part, then switch to the File Status tab (bottom, middle), then on the top, change "Show Pending" to "Show All". This gives you the list of the current files. Right clicking here and selecting log/blame will give you history up to the last state.

David Jameson June 16, 2014
Duh. I keep forgetting about "show all" as a view. Of course that will work. Thank you.
David Jameson June 16, 2014

This only works on current checked out branch. I need to be able to find a file that is in a different branch without checking that other branch out.

Balázs Szakmáry
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 6, 2014

As far as I know, this above is the closest you can get with SourceTree. You will see everything that happened in branches merged to master (or the one you are looking at), but not stuff that happened in "parallel" branches.

David Jameson July 6, 2014

Feature request?

0 votes
Seth
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 15, 2014

As far as I know, you've got three options for getting a file from one branch to another.

1) Merge the branches. This will merge all files, so it probably isn't what you want.

2) Cherry pick. This would need to be done for each and every commit that has effected the file in question, which is likely to be tedious.

3) Checkout the other branch, copy the file in question somewhere (will be the latest copy from that branch), checkout your original branch, and copy the file back in (overwrite what is there). Then commit.

David Jameson June 15, 2014

The command line option

git log --all -- somefile

does it.

There should be a SourceTree equivalent

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events