When it comes to Git, SourceTree is definitely my tool of choice. However, I was surprised to find that there doesn’t appear to be any sort of built-in commit tracking to see which branches do and don’t contain a commit, similar to changeset tracking in Visual Studio. Now, that said, it’s pretty easy to do with Git, there’s just nothing that I could find baked into the SourceTree UI (Am I wrong? Let me know!).
So, if I need to do this, I click the Terminal button in SourceTree and run one of the following commands:
git branch --contains git branch -r --contains git branch -a --contains
The -r and -a parameters can be used to check just Remote or All (local+remote) branches.
Now, SourceTree may not have this functionality built-in, but it can be added easily with a Custom Action. Here’s how you can create a custom action to track a commit across branches.
- In SourceTree (Windows, 220.127.116.11), go to Tools > Options and select the Custom Actions tab
- Click the Add button to create a new custom action
- Enter a caption, and select the option to Show Full Output; for Script to run, enter the path to git.exe; and enter the parameters (note the use of $SHA)
- Click OK to save that bad boy
With the custom action created, you can run it by right-clicking a commit and choosing Custom Actions > Track in Remote Branches.
If you selected the option to show full output, the branches containing the commit will be listed in SourceTree.