💾 Archived View for bbs.geminispace.org › u › wasolili › 16355 captured on 2024-07-09 at 04:22:33. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2024-07-09)

➡️ Next capture (2024-08-18)

-=-=-=-=-=-=-

Comment by 🐦 wasolili

Re: "Beginner tips for beautiful diffs?"

In: s/bash

I use vimdiff as my mergetool. The 4 panes are the BASE file (before your changes or the conflicting commits changes), the REMOTE file (the file with the conflicting commits changes), the LOCAL file (the one with your changes), and the MERGED file (the result of git attempting to merge, has git's <<< === >>> stuff added around the merge conflicts, and is where you actually fix the conflict)

I like this setup a lot, but if it's annoying to you, you can configure git to open vim with a different layout by setting the `mergetool.vimdiff.layout` option (see `man git-mergetool` for details ).

For simple diffs or some pull request reviews, I just use `git diff` and sometimes, if the diff is large, I'll pipe that into vim (if you have syntax enabled, the diff output will be colorized, and having the diff in vim can make reading large but monotonous pull requests easier)

For more complex changes or when I expect I may want to update a file (such as when checking my changes before committing), I'll use `git difftool` (with vimdiff as the difftool).

vim's diff mode is pretty good. I'd recommend reading `:help diff` before skipping it (and maybe `:help windows` if the multiple panes are bugging you)

most times I just open two splits, paste the contents in each, and visually grok, which you can imagine is time consuming and not very efficient.

Running `:diffthis` in each split will show the diff in vim. You may wish to write your own command to handle the whole "new split, paste contents, diff" process (see`:help :DiffOrig` for a sample command you can add to your vimrc which is similar)

🐦 wasolili [flaired user]

Apr 25 · 2 months ago

2 Later Comments ↓

🐙 norayr · Apr 26 at 00:24:

and i prefer tkdiff. (:

☕️ Morgan · Apr 27 at 04:35:

vimdiff sounds like the same UI concept as kdiff3, good to know :) thanks.

Original Post

🌒 s/bash

Beginner tips for beautiful diffs? — I largely prefer command line tools, but when it comes to handling merge conflicts I find command line diff tools confusing (e.g. I'm in vimdiff and I've got these panes open - which is which?) and always end up either using a GUI git client like sublime merge to visualize the diff or dive into the file with conflicts and resolve them manually. Also, there are times when I wish to compare two files or strings. Sometimes I just make some dummy git activity to...

💬 lanterm · 5 comments · 1 like · Apr 23 · 3 months ago