SourceTree 1.3’s new ‘Custom Actions’ feature lets you extend the range of actions you can perform from within the GUI, effectively adding your own commands. Maybe you have scripts that you’d like to call, or external tools that you’d like to use beyond what SourceTree already allows for – Custom Actions are the way to go.
As a simple example, let’s say you use TextMate for editing files in a project, and you wanted to assign a keyboard shortcut to open the root of the repository in TextMate? SourceTree doesn’t provide an in-built option for that, so let’s add it using Custom Actions.
Firstly, open the Preferences window, and select the ‘Custom Actions’ tab:
Econ 203 midterm. Click ‘Add’, and fill in the details as follows (to fill in the keyboard shortcut, just lick on the shortcut area and type a keyboard combination):
Notice how all I had to do was specify the location of the script I wanted to run, and then give it some parameters – in this case ‘$REPO’ which is the path to the repository.
Developers describe SourceTree as ' A free Git GUI client for Windows and macOS '. Use the full capability of Git and Mercurial in the SourceTree desktop app. Manage all your repositories, hosted or local, through SourceTree's simple interface. On the other hand, TortoiseGit is detailed as ' The Power of Git in a Windows Shell '. By executing the git diff command, we can see the differences between these two files. By default, the git diff command produces a diff for all files between the latest commit and the current state of the repository. Run a Git Diff Between Commits. When we run the command, the following response is returned.
Diffing is a function that takes two input data sets and outputs the changes between them. Git diff is a multi-use Git command that when executed runs a diff function on Git data sources. These data sources can be commits, branches, files and more. This document will discuss common invocations of git diff and diffing work flow patterns. 'System default' means whatever you have configured in your.gitconfig already as your default diff tool. SourceTree doesn't change this one - it's there so that ST will by default just pick up anything you've already configured yourself - in your case you must have configured something to use vim at some point.
After I click OK, an ‘Open in TextMate’ option will appear on the top-level Actions menu under the Custom Actions section:
Or, I can just press Shift-T to open my repository in TextMate whenever I want.
If you use the $FILE or $SHA parameters, then these will cause the action to appear on context menus associated with files or commits, and will pass that context to the command. So for example you could have a deployment script which took the $SHA parameter, then right-click on a commit and run your deployment script for that specific commit right from within SourceTree.
Custom Actions are a great new way to extend SourceTree to work with your own scripts and tools, and improve your productivity!
The merge tool that ships with JetBrain's IntelliJ IDEA or WebStorm is really awesome and way better than
FileMerge. It is quite simple to configure SourceTree to use it as the default mergetool:
Open the SourceTree preferences and select the
Visual Diff Tooland as
Paste the following commands into the textfields:
/Applications/IntelliJ IDEA.app/Contents/MacOS/idea diff
$(cd $(dirname '$LOCAL') && pwd)/$(basename '$LOCAL') $(cd $(dirname '$REMOTE') && pwd)/$(basename '$REMOTE')
/Applications/IntelliJ IDEA.app/Contents/MacOS/idea merge
$(cd $(dirname '$LOCAL') && pwd)/$(basename '$LOCAL') $(cd $(dirname '$REMOTE') && pwd)/$(basename '$REMOTE') $(cd $(dirname '$BASE') && pwd)/$(basename '$BASE') $(cd $(dirname '$MERGED') && pwd)/$(basename '$MERGED')
Close the settings. Happy merging!
Git in general
To manually change the mergetool for git in general follow these steps:
~/.gitconfigfile with your favorite editor
Add these lines somewhere in the config:
It takes a few more seconds to launch the IntelliJ merge tool than to launch FileMerge, but it is definitely worth waiting.
Sourcetree Git Download
Based on this article on coderwall: https://coderwall.com/p/gc_hqw/use-intellij-or-webstorm-as-your-git-diff-tool-even-on-windows