Alerting myself of uncommitted changes

I've just set up SourceTree and BitBucket (with Mercurial) so that I can track revisions of my personal scripts and libraries and access them from other machines on occasion. I'm concerned about forgetting to commit changes I make, so I'd like to set up a cron job (or actually, a launchd job, since I'm using a Mac) to check for uncommitted changes and alert me if there are any. I'm new to cloud source control, but I think what I want is to run the equivalent of "hg diff". My working copy will always be in the same place. I ran "Install command line tools" in SourceTree but as far as I can tell that only gave me a tool called stree that serves a different purpose. What should I do? Should I install regular command line Mercurial (looks like from or will that installation fight with SourceTree?

2 answers

1 accepted

1 vote
Timothy Chin Community Champion May 10, 2014

You can choose which hg binaries you want to use in SourceTree preference which means you can use both binaries at the same time.

I used this ( to run bash scripts. You could create your own scripts and check if there are any files that are not changed:

  • hg diff -r START -r END

You can test out the various scenarios, grep the output and do something with it (

Thank you, Timothy. Am I right that SourceTree's embedded Mercurial is not accessible (e.g., from the command line)?

Timothy Chin Community Champion May 11, 2014

Not sure. Never tried to find them before.

Does SourceTree for Mac have a terminal button? If so, does it launch a terminal emulator (on windows it launches mingw), or just the standard Mac terminal in a special location?

Yes, ST for Mac has a terminal button. It just opens up the regular terminal at the location of the repository on disk.

Then I expect you can run embedded Mercurial from the terminal.

Then I expect you can run embedded Mercurial from the terminal.

How would I do this? I've tried just running "hg diff" at the prompt, and "find / -name hg" does not find anything.

Yes, you just need to be contextually specific. When you run any command from the terminal it uses your PATH as a reference. At the terminal, type "echo $PATH" and you'll see a load of output. Those are colon-separated paths which are used in order of appearance to find whatever it is you're calling from the terminal.

To call the SourceTree version in specific you'd have to specify the path explicitly, so "/path/to/the/hg/install/hg <command>".

Hope that helps

Kieran, do you know what the default path is to embedded hg?


The command I wanted (to plug into a script as described by Timothy C.) was:

/Applications/ diff

Thank you, everyone. For posterity the command I wanted was:

/Applications/ diff

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 11, 2018 in Sourcetree

Tip from the team: debugging Sourcetree

Supported Platforms macOS Windows If you're reading this and it's not just educational… we know you're unhappy right now and apologize for that   We're dedicated to improving yo...

114 views 0 5
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