Adding a Confirmation Message to GitX’s ‘Gist it’ Button

gitx-gist-itUse GitX?

Ever been tempted to click the Gist it button? Or maybe you accidentally did click it, only to find out…

GitX will try to upload your current commit as a git patch to gist.github.comGitX User Manual

The attempt will be made without any confirmation on your part.

So, what if you don’t want to upload your commit?

Well, you could just make sure never to click the ‘Gist it’ button.

Or you could disable the button from within the preferences, and flip it back on when you do want to Gist something.


That’s OK, but what I really want is a message confirming the action, so if I do ever accidentally press the ‘Gist it’ button, I can just cancel the request. And since the code that GitX uses to run these commands is in HTML and Javascript, It is very easy to slip in some code of our own.

Here’s how to add a confirmation message for when the ‘Gist it’ button is clicked

fyi. This is a really quick and semi-dirty hack that will be lost if you re-install or download a new version of GitX.

  1. Open Finder > Application, ctrl (right) click the GitX application and select ‘Show Package Contents’.
  2. Navigate to ‘Contents/Resources/html/views/history/’ and open ‘index.html’ in TextMate or other plain text editor.
  3. Add the following within the head tags:
    [code lang=”javascript”][/code]
  4. Update the ‘Gist it’ button to look like:
    [code lang=”html”]
    Gist it
  5. Save the changes made then quit (if open) and re-launch GitX.

Now, whenever you click the ‘Gist it’ button, a notification message will appear within the notification_message div (The same place as ‘Gist it’ status notifications):


confirm_gist() also takes an optional string which can be used to alter the confirmation link, like so:

[code lang=”html”]
Gist it


Re-installing or upgrading GitX will wipe this ‘hack’ which is why I didn’t alter the gistie() method in the history.js file. Altering as little as possible, and only the index.html file makes it a bit easier to ‘track’ and save if a feature like this is not implemented in future releases.

Lighthouse user James T uploaded a patch,, that may be worth a look. It is very similar to what I have done, but involves rewriting-or-renaming the gistie() method and creating two new javascript methods. He also added some nice CSS stylings to the buttons.

You can alter or add to the stylings by adding to the stylesheets found in Contents/Resources/html/css/

Also see GitX’s Lighthouse ticket on this very matter: #58 Suggestion: Usability of “Gist It” button. As of this post (16 March 2009), and GitX ver. 0.6.1, this ticket is still open and clicking ‘Gist it’ will upload your commits to without confirmation.

3 comments on “Adding a Confirmation Message to GitX’s ‘Gist it’ Button

  1. -

    Interesting solution. Cleaner is always better.

    Interestingly, playing around with the app I clicked that Gist it button when playing with a repository from work!

    Hence I quickly submitted a patch to hopefully stop similar happening to others. Interesting blog you have btw. Just added to my google reader.

  2. - Post author

    Same think happened to me… Luckily it was just a “sandbox” repository with little sensitive code in it.

    Clearly your patch got me rolling 😉

    Thanks for the add! 🙂

  3. -

    Good day! Do you know if they make any plugins to help with Search Engine
    Optimization? I’m trying to get my blog to rank for some targeted
    keywords but I’m not seeing very good gains. If you know of any please share.
    Thank you!

Comments are closed.