💾 Archived View for bbs.geminispace.org › u › Morgan › 16322 captured on 2024-07-09 at 05:46:33. Gemini links have been rewritten to link to archived content
⬅️ Previous capture (2024-06-16)
-=-=-=-=-=-=-
Re: "Beginner tips for beautiful diffs?"
The only UI that has ever made sense to me for code merges is kdiff3. Others try to collapse too much, in kdiff3 you get four text regions: main, theirs, yours, output. Simple.
Well, not simple, but at least all the complexity is visible :)
Apr 24 · 2 months ago
🐦 wasolili [...] · Apr 25 at 21:19:
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)
and i prefer tkdiff. (:
vimdiff sounds like the same UI concept as kdiff3, good to know :) thanks.
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...