mirror of
https://github.com/jbranchaud/til
synced 2026-01-05 08:08:02 +00:00
Add Diffing With Patience as a git til
This commit is contained in:
@@ -7,7 +7,7 @@ variety of languages and technologies. These are things that don't really
|
|||||||
warrant a full blog post. These are mostly things I learn by pairing with
|
warrant a full blog post. These are mostly things I learn by pairing with
|
||||||
smart people at [Hashrocket](http://hashrocket.com/).
|
smart people at [Hashrocket](http://hashrocket.com/).
|
||||||
|
|
||||||
_440 TILs and counting..._
|
_441 TILs and counting..._
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -100,6 +100,7 @@ _440 TILs and counting..._
|
|||||||
- [Clean Up Old Remote Tracking References](git/clean-up-old-remote-tracking-references.md)
|
- [Clean Up Old Remote Tracking References](git/clean-up-old-remote-tracking-references.md)
|
||||||
- [Delete All Untracked Files](git/delete-all-untracked-files.md)
|
- [Delete All Untracked Files](git/delete-all-untracked-files.md)
|
||||||
- [Determine The Hash Id For A Blob](git/determine-the-hash-id-for-a-blob.md)
|
- [Determine The Hash Id For A Blob](git/determine-the-hash-id-for-a-blob.md)
|
||||||
|
- [Diffing With Patience](git/diffing-with-patience.md)
|
||||||
- [Dry Runs in Git](git/dry-runs-in-git.md)
|
- [Dry Runs in Git](git/dry-runs-in-git.md)
|
||||||
- [Excluding Files Locally](git/excluding-files-locally.md)
|
- [Excluding Files Locally](git/excluding-files-locally.md)
|
||||||
- [Find The Initial Commit](git/find-the-initial-commit.md)
|
- [Find The Initial Commit](git/find-the-initial-commit.md)
|
||||||
|
|||||||
36
git/diffing-with-patience.md
Normal file
36
git/diffing-with-patience.md
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
# Diffing With Patience
|
||||||
|
|
||||||
|
The default diff algorithm used by Git is pretty good, but it can get
|
||||||
|
mislead by larger, complex changesets. The result is a noisier, misaligned
|
||||||
|
diff output.
|
||||||
|
|
||||||
|
If you'd like a diff that is generally a bit cleaner and can afford a little
|
||||||
|
slow down (you probably can), you can instead use the `patience` algorithm
|
||||||
|
which is described as such:
|
||||||
|
|
||||||
|
> Patience Diff, instead, focuses its energy on the low-frequency
|
||||||
|
> high-content lines which serve as markers or signatures of important
|
||||||
|
> content in the text. It is still an LCS-based diff at its core, but with
|
||||||
|
> an important difference, as it only considers the longest common
|
||||||
|
> subsequence of the signature lines:
|
||||||
|
|
||||||
|
> Find all lines which occur exactly once on both sides, then do longest
|
||||||
|
> common subsequence on those lines, matching them up.
|
||||||
|
|
||||||
|
You can set this as the default algorithm by adding the following lines to
|
||||||
|
your `~/.gitconfig` file:
|
||||||
|
|
||||||
|
```
|
||||||
|
[diff]
|
||||||
|
algorithm = patience
|
||||||
|
```
|
||||||
|
|
||||||
|
or it can be set from the command line with:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ git config --global diff.algorithm patience
|
||||||
|
```
|
||||||
|
|
||||||
|
[source](http://bryanpendleton.blogspot.com/2010/05/patience-diff.html)
|
||||||
|
|
||||||
|
h/t Josh Davey
|
||||||
Reference in New Issue
Block a user