Git Product home page Git Product logo

klondiff's Introduction

Klondike diff

This project is my go at creating an improved diff algorithm, inspired by the Patience diff algorithm of Bram Cohen.

The main focus is improving the readability of the diff output. The main changes are:

  • Whitespace changes and repeated characters (e.g. '=========') have reduced influence.
  • Short lines are neglected, reducing wrong line matches, with for example only brackets.
  • Blocks with changes are interleaved, making it easer to see line differences.
  • In colored diff output the unchanged parts of changed lines are displayed in gold.
  • Changes in indentation have colored background.

Warning: this software is not well tested yet, use at you own risk!

Example

example

Comparison of commit c07c0923 of this repository:

comparison

As you can see the resulting diff is not necessarily smaller, though it is more true to the real changes.

Install (on Linux and the like)

Clone this repo somewhere on your computer, and make symlinks to klondiff and git-klondiff in e.g. ~/bin or ~/.local/bin โ€” some directory in your $PATH (run echo $PATH to see where your shell looks up your commands). For example:

ln -s ~/myclones/klondiff/klondiff ~/bin/klondiff
ln -s ~/myclones/klondiff/git-klondiff ~/bin/git-klondiff

Klondiff requires python3 and patiencediff; to install the latter use e.g. pip (pip3 install patiencediff) or apt-get the python3-patiencediff package on debian/ubuntu/etc.

To run with python2 change python3 to python on the first line of klonpatiencediff.py.

Usage

klondiff file_a file_b

Use with pager:

klondiff file_a file_b | less -R

Use with git:

For incidental use, make a symlink to git-klondiff as described above, then you can use

git klondiff

To use klondiff by default set your configuration (assuming ~/bin/klondiff is your symlink to klondiff)

git config --global diff.external ~/bin/klondiff

To use klondiff for git show, git format-patch and other git log friends use --ext-diff

git show --ext-diff

For git format-patch you'd want to disable color, which is not implemented yet.

Why the name Klondike?

Klondike is a version of Patience, and brings the gold to the surface in diffs with many junk changes.

Piers Titus van der Torren

klondiff's People

Contributors

pierstitus avatar treora avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.