19 ms·
Difftastic: A diff that understands syntax
- taspeotis 5y agoI paid and used SemanticMerge quite successfully when we had a complex Git workflow with lots of conflicts. https://semanticmerge.com/ https://semanticmerge.com/ Since moving to short lived feature branches it is less useful to me.
- Liquid_Fire 5y agoSemanticMerge sounded interesting enough so I wanted to check it out, but to my surprise there is no Buy or Download link anywhere on the site. The only thing that might do it is a Login link, but I don't want to create an account just to see how much the thing costs. Is it only sold in bulk to companies? I find it bizarre that there isn't even a "contact sales" button.
- ziml77 5y agoThat's incredibly annoying! They must have changed something about their pricing and sales model since the time that I had purchased it. I don't understand why companies think that's a good idea. I guess I can't recommend it anymore.
- Aeolun 5y agoThere is a 'sales' button at the bottom, but it's just a link to an email. I'm really not sure how they're even trying to sell this thing. Maybe they don't want to any more? And this is just their subtle way of pushing everyone interested in using it away?
- ziml77 5y agoI don't need SemanticMerge often, but when I do I'm incredibly thankful that I have it.
- bifftastic 5y agoI like the name.
- neves 5y agoNow I want a 3 way merge version :-)
- db48x 5y agoYes.
- emacsen 5y agoThis looks absolutely amazing. One thing I do find interesting (and a wish were different) is that only programming languages are supported, rather than data formats as well. For example, two JSON documents may be valid but formatted slightly differently, or a common task for me is comparing two YAML files. Comparing config files that have a well defined syntax and or can be abstracted into a tree (JSON, YAML, TOML, etc.) would be absolutely lovely, even and including (if possible) Markdown and its ilk.
- mark_and_sweep 5y agoJSON is supported. HTML and XML are missing, too.
- emacsen 5y agoYou're right. I missed JSON. Sadly YAML, TOML and the others I mentioned are not there (yet?)
- softwarebeware 5y agoThere’s always room for contributions!
- simonw 5y agoI would naively expect that this problem is easiest to solve for languages like JSON that have an unambiguous way to be pretty printed.
- chockchocschoir 5y agoIndeed. One could just do `diff $(jq . $fileOne) $(jq . $fileTwo)` and you'll end up with a "nice enough" diff even if $fileOne and $fileTwo were very differently formatted.
- lstamour 5y agoThe problem is when a file also needs to be normalized - e.g. object keys in a different order, YAML syntax expansion. It can be very useful to indicate when a JSON file is identical to another JSON file but some of the properties or array items are out of order and that requires more in-depth knowledge of the data format. Let's not mention that you could UTF-8 encode characters or write out the same character using backslash notation, numeric or boolean data that might be wrapped in a string in one file but not in another, etc. There can still be a lot of modelling and interpretation to consider when comparing data files rather than code files.
- LudwigNagasena 5y agoIs there a good reason why diff tools generally don’t use AST?
- skywal_l 5y agoPerformances is one I guess.
- db48x 5y agoAlso there are a lot of languages out there, each with their own special and unique syntaxes.
- danbruc 5y agoBecause it is much easier, you don't have to build and maintain parsers for hundreds of languages. And you don't need need just any parser, you need very robust ones that can deal with malformed files well. Or, if you only pick a small set of supported languages, your diff tool will not work on most files or have to fall back to a structure-agnostic algorithm. Also not all text files even follow any useful grammar at all. Finally, even if you have a syntax tree, that is just part of the solution, probably the smaller one. Detecting three lines of code wrapped in a new if statement is easy but also doesn't benefit much from a syntax-aware algorithm. But once you changes names and signatures, extract methods, introduce constants, and so on it will become progressively harder to match subtrees and one is probably quickly approaching the territory of NP-hard and undecidable problems.
- NateEag 5y agoThis tool is built on tree-sitter (https://tree-sitter.github.io/tree-sitter/ https://tree-sitter.github.io/tree-sitter/), so presumably it doesn't need to maintain parsers at all. I've thought before this is how diffing should be done, and speculated that tree-sitter would make it more feasible. At this point, whenever I think some language-aware tool ought to exist, my first thought is "Does the language server protocol or tree-sitter make this more feasible?"
- dboreham 5y agoFinally.
- vcmiraldo 5y agoI really like the idea of focusing on producing patches for human consumption. I studied the problem of merging AST-level patches during my PhD (https://github.com/VictorCMiraldo/hdiff https://github.com/VictorCMiraldo/hdiff) and can confirm: not simple! :)
- narush 5y agoCan you give a little color on where the difficulties lie? Is it an efficiency question, or is determining "which changes" hard in the first place?
- scythmic_waves 5y agoNot OP, but the docs call out some "Tricky Cases" [1]. [1] https://difftastic.wilfred.me.uk/tricky_cases.html https://difftastic.wilfred.me.uk/tricky_cases.html
- teeray 5y agoI’d imagine there’s some challenging judgement calls that such a tool would have to make. Like, in Go, you can reorder the members of a struct definition. In many cases this is just diff noise to reviewers. HOWEVER, it does impact the layout of the struct in memory, so it can be semantically meaningful in performance work.
- gmfawcett 5y agoA wild nitpicker appears. I understand where you're coming from & why this matters. But Go, the language spec, doesn't make any guarantees about struct layout at all. A layout difference may be meaningful, practically, but it's potentially unreliable. e.g. see https://groups.google.com/g/golang-nuts/c/1BlZDNBLiAM https://groups.google.com/g/golang-nuts/c/1BlZDNBLiAM Having said that: if a Go compiler for a given architecture decided to change its layout algorithm, I'm pretty sure it would earn a changelog entry.
- 5y ago
- cjohansson 5y agoIf you have consistent code style and formatting this tool is unnecessary. I think that solution is better, you get a more consistent code base that is easier to read for humans. (Also diffs will be faster to compute)
- mcculley 5y agoEven if you are consistent, having unchanged indented text show up differently is very clever. I often end up reviewing a diff that moves a basic block into a conditional branch and have to scan each line to see if it changed.
- mkdirp 5y ago> If you have consistent code style and formatting this tool is unnecessary I disagree. I struggle to replicate it right now using a simple test, but I've seen the following rather infuriating and counter intuitive behaviour from Git/GNU diff. If you have a simple if statement such as: if (bla) { // do something } And you were to add another statement at the end, after the closing curly brace, e.g.: if (bla) { // do something } if (bla2) { // do something else } Git/GNU diff will sometimes show the following diff: diff --git 1/left 2/right index c2ea6f1..dc0e1c2 100644 --- 1/left +++ 2/right @@ -1,3 +1,6 @@ if (bla) { // do something +} +if (bla2) { + // do something else } This is basic example, but there's other similar things. For a simple change like the above, this isn't a huge issue, but for a bigger patch sets, it can take a minute to understand what is really going on.
- Aicy 5y agoLooks really cool, but there was no instructions on how to install it. I would recommend putting an installation guide in your readme, and it being a full installation guide. I followed the link to your manual and then it told me to install your tool using a tool called "cargo" with no reference on how to install cargo. At this point I gave up. Lazy, maybe, but for a convenience tool like this I want a convenient installation.
- childintime 5y agoLooks like you need to install the Rust programming language and compile it. It worked for me. Not sure if I like the installation method. It seems the executable is portable though.
- loxias 5y agoI agree with all your points. Only diff is I got to the point where it said I needed "cargo", On a whim, I typed "aptitude install cargo", and it did something. Now waiting for the >1GB source repo to clone to see if it works.... ;)
- conradludgate 5y agoCargo is Rust's build tool/package manager and can be installed easily using rustup. But I would probably suggest the difftastic maintainers add some prebuilt binaries to the releases (I have an example workflow here if anyone from there is interested https://github.com/conradludgate/wordle/blob/main/.github/workflows/release.yaml https://github.com/conradludgate/wordle/blob/main/.github/wo...)
- 5y ago
- fortran77 5y agoIt supports Elixir and C#! Too bad it doesn't do Erlang and F# It looks very handy though. I still do a lot of C and C++
- loxias 5y agoThis looks really cool and I can't wait to try it, tho... a bit of a PITA to get running. ;) Took a while to figure out how to build, and had to install 400MB of dependencies first.... Edit: And after installing cargo, watching it fail to build, then determining I must need a newer version of cargo, so I built that from source... it fails. Apparently I need to install `rustc-mozilla` and not `rustc`. "obviously". This is all a testament to how much I want to try this tool... MOAR EDIT: even with rustc-mozilla cargo fails to build. running `cargo install difftastic` gives me an error about my version of cargo being too old ;.; Dear author: Let us run your tool.
- YetAnotherNick 5y agoUsed `cargo install difftastic`? Finished in a minute for me.
- lopatin 5y agoBuild errors for me. Apparently I'm on some nightly build of cargo, but I need 2021 version. The pain begins... Edit: Reinstalling Cargo worked!
- skywal_l 5y agoWith rustup, it's pretty easy to update/change your cargo version.
- loxias 5y agoHow did you do it? When I tried to rebuild cargo I got build errors. I'm starting to suspect the only way to run this tool is make a chroot tracking sid or something....
- lopatin 5y agoI just followed the installation instructions here: https://doc.rust-lang.org/cargo/getting-started/installation.html https://doc.rust-lang.org/cargo/getting-started/installation... It'll confirm that you want to install it, because it's already installed I think, and I just selected 1. for Yes.
- buu700 5y agoFor everyone wondering, it looks like this will work with git diff: https://difftastic.wilfred.me.uk/git.html https://difftastic.wilfred.me.uk/git.html.
- Starcrunch 5y agoExactly what I was looking for. Thanks!
- tzahifadida 5y agohow do i install on macbook to try? Can you give some instructions in the getting started?
- sebdufbeau 5y agoFrom https://difftastic.wilfred.me.uk/getting_started.html https://difftastic.wilfred.me.uk/getting_started.html, it's installed via Cargo, so if you already have Cargo installed its straightforward, otherwise you can install it via https://doc.rust-lang.org/cargo/getting-started/installation.html https://doc.rust-lang.org/cargo/getting-started/installation...
- ryanianian 5y agobrew install rust cargo install difftastic Worked for me without any problems.
- cyberge99 5y agoNice tool! I've used icdiff for this in the terminal, but I'll see how this performs in my workflow. Since I use VSCode as my editor, I created this oneliner in my .bash_profile: # VS Code Diff diffcb () { "/usr/local/bin/code" -n --diff $@ > /dev/null 2>&1 ; } With it, I can "diffcb filename1.json filename2.json" to get a visual editor with contextual awareness based on installed lint modules.
- challenger-derp 5y agoFirst thing that came to mind is diffing python notebooks.
- gh02t 5y agoDon't think this tool supports that, but there is https://nbdime.readthedocs.io/en/latest/ https://nbdime.readthedocs.io/en/latest/
- cycomanic 5y agoFor Jupyter Notebooks I highly recommend trying out jupytext, which converts Notebooks on the fly to a number of formats. It really has been a game changer for working with git and Notebooks for me. I essentially never want to preserve state of the notebooks anyway so converting just makes sense. The best thing is it is completely transparent, i.e. it generates a notebook file when you open the other file and saves to the file ever time the notebook is saved. If you want to keep the state of the notebook you can always keep that file around as well.
- dmarinus 5y agoLooks nice! Now I only need patchtasic :-)
- dotancohen 5y agoActually, the README addresses that! > Non-goals > Patching. Difftastic output is intended for human consumption, and it does > not generate patches that you can apply later. Use diff if you need a patch.
- db48x 5y agoThis is written by the same guy who wrote Helpful, an enhancement package for the Emacs Help buffer. I highly recommend checking out Helpful if you haven’t seen it. https://github.com/Wilfred/helpful https://github.com/Wilfred/helpful
- disgruntledphd2 5y agoHelfpul is (pun fully intended) so very, very helpful. Honestly, I cannot imagine going back to the standard emacs help.
- db48x 5y agoAgreed. It’s so good it feels like it should have been that way all along. For example, when you view the help for a function Emacs has always given you a link to the source code where that function is defined. Helpful shows you the source code right in the Help buffer, and shows you a list of callers, and gives you buttons that enable tracing or debugging for the function. Once I discovered Helpful, all of those things seemed so obviously useful that I can’t understand why nobody else thought to put them there, including myself.
- disgruntledphd2 5y agoThe best part is the forget function, for when functions are incompatible. As an example, lsp won't work for me unless I forget the project-root function from ess-r (I have no idea why this hasn't been fixed) and helpful makes this a two or three key activity.
- maw 5y agoHe wrote https://github.com/Wilfred/deadgrep https://github.com/Wilfred/deadgrep too. It's awesome and I don't know how I lived without it for so long.
- CodeIsTheEnd 5y agoEDIT: Wilfred IS the original author [3]; my apologies. Not to discredit Wilfred (it looks like he's taken over the project as the maintainer), but, based on the historical contributions [1], it looks like it was originally developed by Max Brunsfeld, who also created Tree-sitter. [2] [1]: https://github.com/Wilfred/difftastic/graphs/contributors https://github.com/Wilfred/difftastic/graphs/contributors [2]: https://github.com/tree-sitter/tree-sitter https://github.com/tree-sitter/tree-sitter [3]: https://github.com/Wilfred/difftastic/commit/958033924a2dea78ccd85c93f4c6abdafa5dbf04 https://github.com/Wilfred/difftastic/commit/958033924a2dea7...
- _jfib 5y agoI would love it if version control stored an AST that also includes comments and dividers (where right now we would leave an empty line) and dev machines rendered it out however they wanted. They could even change the language of keywords in addition to normal formatting.
- tluyben2 5y agoYep, I posted this idea on Reddit recently and people said they need a formatted syntax because of diff and version control; we do not; get the ast, reformat in the editor as the particular user fancies and generate diff and version control artefacts also as a particular user sees fit. Our computers are very fast so you can make a lot more different views on your code than we have now by using the ast instead of text and regexps.
- pie_flavor 5y agoThis exact project is called JetBrains MPS.
- adolph 5y agoMPS seems to be a DSL authoring tool. How would this be used to make an AST diff tool? https://www.jetbrains.com/mps/ https://www.jetbrains.com/mps/ https://en.wikipedia.org/wiki/Abstract_syntax_tree https://en.wikipedia.org/wiki/Abstract_syntax_tree
- pie_flavor 5y agoWell, the comment I was responding to was about storing the AST, not diffing it. If that's what you meant the one follows naturally from the other. Once the file format is the AST instead of its visual representation, it makes sense to implement lots of operations as DSL extensions instead of library features, because the language is the library in a sense. MPS is marketed as a DSL tool but what really is is a projectional language tool.
- glenjamin 5y agoTo do this requires some standard way of encoding an AST which includes comments and dividers. That standard format is commonly known as source code - although it lacks a normal form. Tools like prettier, gofmt and black can be thought of as a way to produce a normal form of source code. This is (IMO) a reasonable incremental approach towards exactly what you describe - if a project checks in only source code that's formatted using a standardised format, then you're free to work on it using whatever equivalent representation you like - as long as it's converted back at commit-time.
- foreigner 5y agoI LOL'ed at the first page of the manual: "When it works, it's fantastic."
- pluc 5y agogood idea, but so dangerous though
- mkdirp 5y agoWhy?
- pluc 5y agobecause it's an automated piece of software making decisions about what is an "equal diff" and what is a "difference diff" because a diff no longer means just a change, it now has to be a meaningful enough change.. If you removed something like `if (true)` or whatever, that's still a diff that could have some importance and/or unknown consequences. I appreciate the value, but the fact that it allows refactoring to be a non-diff would worry me in the long run I think.
- Wilfred 5y agoDifftastic is only ignoring whitespace that isn't significant. If you remove `if (true)`, it will get highlighted. With a textual diff today, your only choices are 'highlight all whitespace changes' (e.g the git default) or 'ignore all whitespace' (e.g. diff --word-diff). If difftastic says there are no changes, then both files have the same parse tree and the same comments.
- pabs3 5y agoA related thing is cregit, which does diffs of tokens: https://github.com/cregit/cregit https://github.com/cregit/cregit https://lwn.net/Articles/698425/ https://lwn.net/Articles/698425/
- Wilfred 5y agoOoh, I'd not seen this and I've seen a bunch of diff tools at this point! Thanks for sharing.
- ducktective 5y agoSo how can one use this in vim?
- sanity31415 5y agoUnfortunately it's closed source, but https://www.semanticmerge.com/ https://www.semanticmerge.com/ has been around for a few years and works similarly, but can also merge.
- oauea 5y agoI just spent a few minutes on that site and I can't even figure out how to try it out, or their pricing, or anything other than some very superficial docs, really. Is this just a pretty website, or is the software actually available anywhere?
- Pet_Ant 5y agoThat pages is just the technology primer. The tools are XDiff & XMerge: https://www.plasticscm.com/pricing https://www.plasticscm.com/pricing Looks like no locally-run-binary/non-SaaS version. I was hoping it'd have SublimeText like model. I have no interest in trying to get my team to switch nor having to deal with the security team when it turns out I was using a free cloud account.
- rom1v 5y agoIt might be useful for reviewing merge/pull requests. But is there a way to display the diff "interleaved" instead of 2-columns side-by-side? (when executing `GIT_EXTERNAL_DIFF=difft git log -p --ext-diff` for example)
- Wilfred 5y agoThere's a basic single-column 'inline' display available if you do `INLINE=y`, but it's not as mature as the side-by-side display yet.
- DarkPlayer 5y agoWe are working on a code review tool which supports unified diffs with semantic diffing. If that sounds interesting for you, take a look at https://mergeboard.com https://mergeboard.com
- synergy20 5y agoI use meld and it seems syntax aware plus it can do merge with a click, how will difftastic diff in that regard?
- berkes 5y agoI use meld too. But afaics, meld 'syntax aware' is very different from from difftastic. Meld takes a diff, and applies syntax highlighting over the diffed files. It additionally highlights the changed characters in a line. Git diff, vimdiff and probably others, do this as well. From the demo, I understand that Difftastic first applies syntax and then rebuilds the patch over that. Being aware of line wrapping, changes in nesting, moving codeblocks into functions and so on.
- kid64 5y agoThis is great. I previously used Code Compare by Devart for this purpose, but it has been abandoned without support for modern IDEs.
- yboris 5y agoMy favorite dev tool is diff2html - a CLI that opens up your browser with a rich diff. Pro tip: alias `diff` to the command so you can launch it quickly ;) https://diff2html.xyz/ https://diff2html.xyz/
- Pet_Ant 5y agoI was interested in SemanticMerge/XMerge but when I looked they didn't have a Mac clinet and now it looks like they don't have a personal edition. I just want to buy a private license and use it locally. https://semanticmerge.com https://semanticmerge.com
- password4321 5y agoThey are requesting feedback on the pricing model for the latest revision of the technology, maybe HN could change their minds: https://www.gmaster.io/pricing https://www.gmaster.io/pricing
- Pet_Ant 5y agoOS X and Linux are "wait & see" again. That describes half of our dev team and most of the seniors.
- rcthompson 5y agoWhat does it do for unsupported languages? Just fall back to "regular" diff?
- Wilfred 5y agoYep! It does a conventional textual diff: run Myers' diff algorithm on lines, then word highlighting on changed lines.
- rcthompson 5y agoI wonder if it would be possible to do this in a one-column format. That would make it more useful in a lot of contexts where a super wide view isn't practical.
- jedisct1 5y agoNo support for Zig :(
- Wilfred 5y agoDifftastic has support for ~20 languages, and I'm happy to add more if there's a decent tree-sitter parser available :)
- pvg 5y agoA previous discussion from 8 months ago, with some comments by the author and authors of other diff tools: https://news.ycombinator.com/item?id=27768861 https://news.ycombinator.com/item?id=27768861
- gwbas1c 5y agoNow lets get a WASM build into Github. :)
- racl101 5y agoOk I really gotta try this.
- thefaux 5y agoThe nine year old inside me can’t unsee the unfortunate choice of names used in the basic example :)
- sytelus 5y agoIs there a VSCode extension for this?
- yewenjie 5y agoDoes a `magit` plugin exist for Emacs users? The author of this package is also the author of a couple of popular Emacs packages but I did not see any mention of Emacs.
- Myrmornis 5y agoIt won't be able to form the basis of a magit plugin because it does not target traditional diff format.
- db48x 5y agoTo be more precise, Magit could easily display the output of difft, but Magit wants to be able to do more than that. You can navigate diffs by hunk and by file, you can collapse hunks and files, you can even select individual lines of the diff to stage or unstage them, apply or unapply them, etc. Strictly speaking that’s probably not impossible with difft, but because difft has the explicit goal of displaying diffs to humans rather than producing machine–parsable output, it won’t be easy. I still want it to happen though.
- aasasd 5y agoPersonally I long for a syntactic merge-tool. Every time Syncthing hiccups for some reason, I'm up for a merge session with my Org-mode files, in the vein of: ‘These properties look just like those ones, only with a different timestamp... Oh lookie, and the heading is totally changed. Let me merge this new heading all over the old one, and then pop in the old one after it.’ Dammit, it's just a whole new heading added with properties. This happens with every language heavy on markup. However, I'm not sure if Org markup lends itself to structuring that would allow proper diffing—even with just the headings.
- teknopaul 5y agoBe good to have different git merge strategies per file type. e.g. A merge that knows properties files support the same property added in different places but only once is needed. And another strategy if order is significant. Cool to have an HTML merge that recognises the tree structure and supports merging tags and having the indentation follow some rules. I believe git supports merge strategies, its been on my todo list forever.
- 29athrowaway 5y agoToday in generation Z rediscovers things: semantic patching. https://en.wikipedia.org/wiki/Coccinelle_(software) https://en.wikipedia.org/wiki/Coccinelle_(software)
- rednosehacker 5y agoAny plan for the Scheme programming language ?
- Wilfred 5y agoI'd like to add it, but I haven't found any good tree-sitter parsers for Scheme.
- einpoklum 5y agoThe documentation says: > Difftastic output is intended for human consumption Why not separate the human-consumption part and the underlying parsing part? Or at least provide both in the same utility?
- Wilfred 5y agoThe underlying parser is just tree-sitter, which is a reusable (and excellent) parsing library. Difftastic then converts the tree-sitter parse tree to a simpler s-expression style format (see https://difftastic.wilfred.me.uk/parsing.html#simplified-syntax https://difftastic.wilfred.me.uk/parsing.html#simplified-syn...), and computes differences on that. I'm just trying to clarify that I'm not generating conventional 'unified diff' patches, so I can provide a nicer interface (e.g. line numbers).
- goombacloud 5y agoFor easy git usage I created these two scripts in my PATH instead of using using git config: git-difft: #!/bin/sh GIT_EXTERNAL_DIFF=difft git diff "$@" git-showt: #!/bin/sh GIT_EXTERNAL_DIFF=difft git show --ext-diff "$@" Then you can run "git difft …" or "git showt …" if you want to use it.
- matheusmoreira 5y agoThis is really nice, thank you!
- hyperpallium2 5y agoBTW IIRC The tree version of levenshtein distance has (proven) terrible complexity. But so does lcs, and diff itself performs great in practice so maybe...
- einpoklum 5y agoChecked out the repository. Build instructions? Nope. Minimum system requirements? Nope. But if you check out cargo.toml, you'll see it says it needs Rust 1.56. My system has 1.48.0 . And it the latest Debian release! I don't see how a diff tool can expect you to have a bleeding-edge development environment. I mean, ok, you chose a new language - I can understand that; I won't demand that it build with just a C compiler and Make. But come on, this is not supposed to be just a toy for new systems. Anyway, I still cloned it, tried to build with "cargo build", and got stuck with: error: unexpected token: `include_str` it couldn't even tell me "get Rust 1.56" :-(
- simulate-me 5y agoThe quick examples seem like they could all be solved using git diff's --ignore-all-space option.
- NaturalPhallacy 5y agoYou hit us up when we can build & install it.
- pabs3 5y agoA diff tool for binary files: https://diffoscope.org/ https://diffoscope.org/
- dools 5y agoFunny side note: I had a flat mate once who was on a working holiday from Japan. He was in love with and endlessly curious about English slang, it’s basically all we talked about. I remember explaining to him why my uni friends and I referred to things as being “craptastic”, starting with American marketing’s love affair with the portmanteau. He got it pretty quickly and enjoyed using it in conversation. The saying that was harder for him to understand was “fuck all”. He always wanted fuck to be the verb, rather than using “fuck all” as the adjective, so he would say things like “I fuck all my money last night at the pub”.
- benreesman 5y agoI know native English-speakers who would say that s/pub/bar/. Profanity is just delightful in general, and non-native English speakers come up with some of the best profane idioms in English. I wonder if it’s the same in other languages?
- roeles 5y agoPerhaps this book would have helped. https://www.amazon.com/gp/aw/d/486256139X https://www.amazon.com/gp/aw/d/486256139X
- soheil 5y agoYes! Why did it take so long for this to be invented? So obviously and amazingly useful.
- krick 5y agoUnderstanding syntax would be really amazing for merges (not sure if it's even possible), but for diffs I don't immediately see why I should use that over simpler syntax-unaware tools. Highlighting the actual change in a string is important, and so is ignoring whitespace, but diffsofancy -w does it just fine. What else would I need? (Well, I guess the only use-case I can see from the demo is 2 compact changes in a single line, but… meh.) On the other hand, even though my diffs are usually not that huge, sometimes they might be, and I don't want to switch tools every time that happens (I have just git alias and I don't even remember my exact config, nor should I care). So being slow is not great.
- SuperSandro2000 5y agoDelta is a pager that does Syntax highliting, better diff highliting and improved outputs of existing git commands. Highly recommended. https://github.com/dandavison/delta https://github.com/dandavison/delta
- goombacloud 5y agoI find ydiff more useful, specially for the side-by-side output: https://github.com/ymattw/ydiff https://github.com/ymattw/ydiff I'm using it like "git-ydiff-s" script in my PATH to use "git ydiff-s": #!/bin/sh git diff "$@" | ydiff -s --wrap --width=0 Installation is "sudo dnf install ydiff" or curl -fsSL https://raw.github.com/ymattw/ydiff/master/ydiff.py https://raw.github.com/ymattw/ydiff/master/ydiff.py > ~/bin/ydiff chmod +x ~/bin/ydiff # (and change to python3)
- steerablesafe 5y agoWhat would be also cool is a syntax aware custom merge driver for git, but that's probably even harder.