Hacker News

oug-t
Show HN: difi – A Git diff TUI with Neovim integration (written in Go) github.com

nesk_13 hours ago

One recommendation to help this tool gain traction: use a black and white terminal for your terminal preview (GIF).

1. It will ease reading. It's currently terrible, you might be used to it but we aren't.

2. It will sharpen the text and make it easier to read since there's less to encode into the GIF format.

Additional recommendations: remove the useless part on the right—I use Arch BTW vibe—and make the font bigger.

junkblocker12 hours ago

"What is that, a gif for Ants?"

It's really hard to see what is going on in that small blurry demo gif. So please make it bigger in addition to parent's suggestions.

oug-top12 hours ago

I am so sorry for that gif, just updated it!

oug-top12 hours ago

Great advice!

I will update it now.

freedomben12 hours ago

Looks like a neat tool, and one I really need! I actually started building my own because I couldn't find anything satisfying. My build is currently in the very early stages and I'd love to abandon it :-) I'm definitely going to try difi out.

Also kudos for putting up a screenshot. I've looked through a lot of projects claiming to do similar to this, but there are so many different interpretations that can make it not a good fit for me, and when there aren't any screenshots the barrier of seeing it in action is often too high to where I only try one or two before I give up and stop wasting time. Having a screenshot made it so I could check it out quickly.

The screenshot is a little rough, so a few tips for next time:

1. Shrink your terminal window down a bit as a huge view is harder to follow

2. Keep the screenshots at full resolution so they are easier to read. The reduced resolution and the original screen being huge makes the text pretty difficult to read, even zoomed in to 200%

3. Use something like screenkey (or throw some subtitle text up or something) so the viewer knows what keys you are pressing and/or what you're trying do. It's pretty hard to follow along without those cues.

Great work, and thanks for sharing!

oug-top12 hours ago

Thank you for those great advice!

I will definitely refine my screenshot demo!

freedomben11 hours ago

Awesome, looks fantastic! Thanks

verdverm10 hours ago

https://github.com/jesseduffield/lazygit

Full featured, also written in go, if that sort of thing matters to you

oug-top10 hours ago

`lazygit` is incredible, it is definitly the gold standard for full git management in the terminal.

`difi` focuses for a much simpler review workflow, a TUI for `git diff`.

Thanks for sharing!

halostatue7 hours ago

I primarily use lazygit for diff/patch editing as I'm preparing PRs so that commits are in a useful order for reviewers (at least those who choose to go commit-by-commit).

Aside from the fact that I've built workflows for lazygit related to patch editing, the main issue I'd have with `difi` is I use vim and won't use nvim (which should have the tagline "not vim", not "neo vim", because it's not vim in very important ways).

verdverm10 hours ago

how is it simpler?

1. It looks an equivalent diff experience as lazygit

2. As soon as I need to do something more than `git diff`, it becomes more complex (by nature of needing multiple tools to get my job done)

A minimal tool in itself does not confer greater simplicity

xyzzy_plugh11 hours ago

For vim heads also worth checking out tpope's fugitive:

https://github.com/tpope/vim-fugitive

Very useful for inspecting and staging changes, making commits, etc.

I find you can pretty much do anything with it, and it's much faster than anything else, but it does have a slight learning curve. The documentation is very good!

mbsa711 hours ago

This looks promising, thank you. I always used GitGutter and having to remember “: GitGutterDiffOrig” just to see my changes is a pain sometimes, this plugin seems more intuitive.

VTimofeenko11 hours ago

Check out whichkey and/or command line completion to find those commands easier

oug-top11 hours ago

Yes, fugitive is awesome!

I use it all the time for staging changes and commits in nvim!

oug-top14 hours ago

Personally speaking the git diff command is great for output, but can be improved for reviewing.

With difi the TUI made for git diff it allows to me speed up the review process and make it more enjoyable.

For the nvim integration, there already exists diffview and code diff, but I still favors the github website's solution of highlighting + and - inside one file rather then side by side.

difi: https://github.com/oug-t/difi difi.nvim: https://github.com/oug-t/difi.nvim

fish555 hours ago

diffview.nvim also supports side by side view. Lazygit does as well, and opens files in $EDITOR.

vhantz12 hours ago

In the readme there are only commands explicitly running the tool. Can it be set as the diff tool for git? If not, you should look into that. It will help adoption. And if yes, you should make it clear in the docs.

oug-top12 hours ago

Great advice, I will look into it!

oug-top12 hours ago

I add it inside a new section `## Git Integration`, thank you!

kolja00511 hours ago

Hey pretty cool! I recently added a similar feature to my neovim setup. I can press a keymap and cycle through all of the unstaged git hunks with each shown in a preview window. I can also change the base branch to one that, say, I'm trying to merge into so that I can have the same workflow when doing code reviews.

oug-top10 hours ago

That sounds like a killer workflow!

For pure speed on small PRs, your setup sounds perfect!

manescianera11 hours ago

Looks neat! Any chance to integrate delta with it?

https://github.com/dandavison/delta

nickjj10 hours ago

Delta is great.

Fortunately you can create a git diff TUI using `fzf` and `git diff` with pretty much a 1 line shell script.

For example: https://github.com/nickjj/dotfiles/blob/master/.local/bin/gd

If you run `gd` or `gd --side` it will show you a diff.

Delta can be used as a git diff tool by configuring your git tools, such as: https://github.com/nickjj/dotfiles/blob/master/.config/git/c...

manescianera7 hours ago

I'm using fzf time to time but for some reason never thought of setting up git diff like that. Thanks, I think I will borrow this :)

oug-top10 hours ago

Delta looks beautiful!

I will definitely try to integrate it with `delta`.

Now `difi` is enabling interactive feature when for letting user to see the changes directly inside editor with nvim plugins. `delta`'s outputs formatted ANSI text is also very interesting to integrate!

theappsecguy11 hours ago

Would love if this was something capable of doing PR reviews with comment threads, etc! Super tired of having to open up Intellij to get the only usable option for that kind of flow

oug-top10 hours ago

Great point! I personally likes gh-dash for PR management.

I will definitely try to find a integrated work flow between those two!

theappsecguy8 hours ago

I love gh-dash, but like you said it's more in the realm of PR management rather than a fluid PR review tool!

oug-top6 hours ago

Yes! After using gh-dash, I came up the idea to create this tool with Bubbletea to work along with gh-dahsh.

oug-top12 hours ago

Curious to hear thoughts on editor support, do you guys feel specific integrations (Emacs/Vim) are necessary for tool like this, or the TUI work flow is enough?

Now it mainly supports `nvim`.

kalterdev11 hours ago

I think that regular black-and-white /bin/diff is solid for that kind of job. I use it all the time. I have seen people being mad about reading its output but I think that this attitude is unfounded.

jlarocco11 hours ago

Sorry to be a wet blanket, but Magit for Emacs already has a convenient UI for reviewing diffs (as well as viewing status, logs, rebasing, etc.), so I don't know if I personally would use this tool from Emacs.

But it wouldn't hurt to have an option to make "e" to open files in Emacs or the user's choice of editor.

oug-top6 hours ago

Thanks for sharing that information!

LysPJ10 hours ago

Looks nice! Any chance of a side-by-side mode?

oug-top10 hours ago

Definitely, I will try to do a TUI integration with `diffview` anad `codediff` which supports beautiful side side mode.

Thank you!

lasgawe10 hours ago

This looks really cool. I need to try it. Previously I used Sublime Merge for diff issues.

oug-top10 hours ago

Thank you ~

pure-orange10 hours ago

very nice, lovely tui. Does it support viewing the diff of unstaged files? I tend to do a lot of commit amending locally so would be nice if I could see the status of these before I amend the commit

oug-top10 hours ago

Thanks! Great point.

Now it defaults to comparing current branch vs `main` for PR review, but I will definitely see the value in a `local changes` mode for pre-commit checks!

yearolinuxdsktp13 hours ago

Reminds me of `tig`, which is a TUI with a continuous diff (not side by side) viewer… you can revert chunks inline. Has tree view, diff view and blame view.

oug-top12 hours ago

Yes tig is awesome!

I am also trying to add integration for this TUI with nvim `diffview` and `codediff` support.

WorldMaker12 hours ago

git itself also has the lesser known `git add --patch` (or `-p`), the interactive staging tool (not to be confused with `git add --interactive` or `-i`, which does add more interactive tools but has a much more complex TUI that doesn't start from diffs).

OJFord11 hours ago

It really should be the default, with the current 'git add' behaviour behind '--the-whole-damn-thing-i-dont-care-what-the-diff-is'.

WorldMaker11 hours ago

Yeah, one of the things I miss most from darcs was that being the default experience and also the only step in change creation (`darcs record` versus `git add -p; git commit`; darcs also had a `darcs add` but it was to opt-in source files to status tracking, a reverse of the `.gitignore` opt-out approach).

oug-top11 hours ago

Totally agreed!

Brining `git add -p` style staging into the UI is definitely something worth thinking about.

hn-front (c) 2024 voximity
source