Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add hashbang to gist-diff.js; update readme to drop node prefix in bo…

…th alias definitions, replace long names with two character short names
  • Loading branch information...
commit 6376f6ed400c557df5869c8c66beefae758eeb56 1 parent 1def332
@jzaefferer jzaefferer authored
Showing with 15 additions and 9 deletions.
  1. +7 −5 gist-diff.js
  2. +8 −4 readme.md
View
12 gist-diff.js 100644 → 100755
@@ -1,3 +1,5 @@
+#!/usr/bin/env node
+
var https = require( "https" ),
exec = require( "child_process" ).exec,
diff = require( "./diff" );
@@ -6,11 +8,11 @@ getAuth(function( username, password ) {
var auth = username && password ? username + ":" + password : null,
args = process.argv.slice( 2 ),
publicGist = args.indexOf( "--public" );
-
+
if ( publicGist !== -1 ) {
args.splice( publicGist, 1 );
}
-
+
diff( args, function( error, parsedDiff ) {
var files = {};
for ( var file in parsedDiff ) {
@@ -30,11 +32,11 @@ function postGist( settings, auth, fn ) {
headers = {
"Content-length": data.length
};
-
+
if ( auth ) {
headers.Authorization = "Basic " + new Buffer( auth ).toString( "base64" );
}
-
+
var req = https.request({
host: "api.github.com",
port: 443,
@@ -51,7 +53,7 @@ function postGist( settings, auth, fn ) {
fn( JSON.parse( response ) );
});
});
-
+
req.write( data );
req.end();
}
View
12 readme.md
@@ -1,16 +1,16 @@
# Pretty Diff
Pretty diff generates colorized HTML diffs similar to the diff/commit views on GitHub.
-Simply use `git pretty-diff` the same way you use `git diff` and you'll get pretty diffs.
-If you want to share the diff, you can use `git gist-diff` and you'll get a new gist.
+Simply use `git pd` the same way you use `git diff` and you'll get pretty diffs.
+If you want to share the diff, you can use `git gd` and you'll get a new gist.
## Installation
Clone the repo and then create a Git alias. Open `~/.gitconfig` and add:
[alias]
- pretty-diff = !node /path/to/pretty-diff.js
- gist-diff = !node /path/to/gist-diff.js
+ pd = !/path/to/pretty-diff.js
+ gd = !/path/to/gist-diff.js
## Usage
@@ -19,6 +19,10 @@ Clone the repo and then create a Git alias. Open `~/.gitconfig` and add:
pretty-diff has no settings of its own.
Simply provide whatever settings you want to pass to `git diff`.
+For example, to see what changed in the last commit:
+
+ git pd HEAD^
+
### gist-diff
gist-diff has one setting: `--public`.
Please sign in to comment.
Something went wrong with that request. Please try again.