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

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

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.

Duh. I keep forgetting about "show all" as a view. Of course that will work. Thank you.

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.

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.

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.

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
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published May 30, 2018 in Sourcetree

Tip from the team: configuring Git or Mercurial in Sourcetree

Supported Platforms macOS Windows To make using Sourcetree as simple yet powerful as possible we embed (bundle) dependencies such as Git, Git LFS, and Mercurial. We strive to keep these...

542 views 1 2
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