Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #1 from jzaefferer/master

Everything better, and more
  • Loading branch information...
commit 9783d4ec1d8984ad4e3c3c8e35867ea3e57198d2 2 parents 1def332 + ae30cae
@scottgonzalez authored
Showing with 20 additions and 9 deletions.
  1. +7 −5 gist-diff.js
  2. +8 −4 readme.md
  3. +5 −0 template.html
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`.
View
5 template.html
@@ -4,6 +4,11 @@
<meta charset="utf-8">
<title>Pretty Diff</title>
<style>
+ h2 {
+ font-family: Arial;
+ font-size: 1.2em;
+ margin-bottom: 0.3em;
+ }
.file-diff {
width: 800px;
overflow: auto;

2 comments on commit 9783d4e

@jzaefferer

You just clicked the green button, didn't you? It could have been a fast-forward!

@scottgonzalez

I did, I was being lazy :-P

Please sign in to comment.
Something went wrong with that request. Please try again.