How to use Sourcetree and P4Diff


This might be useful for other people but mainly I’m writing this for my own future reference. You could use other git clients and diff tools.

A graphical git client like Sourcetree let’s me view the history of files and roll back to earlier commits. I don’t mess with branches but I think this would allow that too. I find Defold’s built in diff tool lacklustre so prefer to use P4Merge to review changes before committing them.

  1. First use Defold to create/sync your project. You’ll end up with a folder with a game.project file in it, this is the root of your project and there will be a hidden .git folder here.

  2. In Sourcetree go to File -> Open and select the project root folder. This will add a new tab for your project in Sourcetree.

  3. Click Fetch in the top bar. This will try to check for new commits and will ask for credentials. The username is the email address you use to login to The password is a token you need to generate by going to, navigating to your project, clicking your username in the top right, settings, Generate access token. Make a note of this hex string as it will change each time you click the button, so if you click it again the password prompt will come up again when you try to do something. This token is the same for all projects but you will need to login per project.

  4. Go to Tools -> Options -> Diff and set the External Diff Tool and Merge Tool to P4Merge.

In Sourcetree if you go Tools -> Options -> Authentication you should see some saved passwords for The repo URL for Defold projects is where XXXXX is the Project ID number. You can find your Project ID by logging into the dashboard and navigating to your project, the URL will now be You can also go to the Settings tab of your project in the dashboard.

If you get git errors about not being able to access you may have to mess about with a git config setting as explained in this thread. I did that at some point but I don’t know if it’s still relevant.