Use 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.com - GitX 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.
- Open Finder > Application, ctrl (right) click the GitX application and select ‘Show Package Contents’.
- Navigate to ‘Contents/Resources/html/views/history/’ and open ‘index.html’ in TextMate or other plain text editor.
- Add the following within the head tags:
-
<script type="text/javascript" charset="utf-8">
-
var confirm_gist = function(confirmation_message) {
-
// Set optional confirmation_message
-
confirmation_message = confirmation_message || "Yes. Paste this commit.";
-
// Show div#notification, since it’s set to display:none; by default
-
$("notification").style.display = "";
-
// Hide img#spinner, since it’s visible by default
-
$("spinner").style.display = "none";
-
// Insert the verification links into div#notification_message
-
$("notification_message").innerHTML = ‘This will upload your commit to http://gist.github.com/<br/>Are you sure you want to continue?<br/><br/>’ +
-
‘<a href="#" onClick="hideNotification();return false;">No. Cancel.</a> | ‘ +
-
‘<a href="#" onClick="gistie();return false;">’ + confirmation_message + ‘</a>’;
-
}
-
</script>
- Update the ‘Gist it’ button to look like:
-
<a class="servicebutton" id="gist" onClick="confirm_gist();return false" href=‘#’>
-
Gist it
-
</a>
- 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:
-
<a class="servicebutton" id="gist" onClick="confirm_gist(’Upload this commit.’);return false" href=‘#’>
-
Gist it
-
</a>
Caveat
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, https://gist.github.com/fc3c9773f6a2bcbeb7a9, 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 gist.github.com without confirmation.