Code Review from the Command Line
blog.jez.io
blog.jez.io
`git heatmap`[2] is also cool. It should be easy to implement as an alias; this is 80% of the way there:
git log --name-status --pretty=format: | sed '/^$/d' | cut --fields=2- | sort | uniq --count | sort --numeric-sort --reverse | head
[1] https://github.com/jez/git-madgeWhen you're looking to review what happened on $review_branch, you really only need to lookup where their branch begins, and then take look at the diffs.
Where the branch "begins" is the merge-base of your current commit (assuming you're up to date) and the review branch tip.
review_branch=origin/branch-name
branch_point=$(git merge-base $review_branch HEAD)
git difftool $branch_point $review_branch
One advantage is that "git difftool" has support for vimdiff and a whole bunch of other diff tools. The upside of leveraging difftool is that you can use all of the bulitin git diff stuff, eg. using `-- <path>` at the end of the command to limit the diff to just the specified paths.If you want to diff everything in one shot, "git difftool -d/--dir-diff" will do that too.
https://git-scm.com/docs/git-diff#Documentation/git-diff.txt...
Putting this into practice requires very little alteration in the commands to run: `git diff --stat` becomes `git log --stat`, and `git diff` becomes `git log --patch`.
I'll stick with my web interface. When that doesn't suffice, I'll check out the remote branch locally and navigate around with the full power of my IDE.
Web tooling for git is very shallow; I wouldn't want to be without `git add/commit -p` for example.
I was there, when cool GUIs were only available in very expensive computers, and I could buy a car or give a house entry payment with similar price points for graphical workstations.
I really don't get the point why people keep doing the extra mile to work just like we were forced to during the early days of computing.
VSCode by definition of being Electron based has the whole power of HTML 5 and CSS at plugins disposition.
Those terminal emulations are running on top of WebGL and canvas, while emulating a 1980's VT100 terminal.
Push, merge, pull, status, etc - those quick things from command line - preferably from the IDE terminal or sometimes standalone terminal (with quick CMD+TAB switch). Seeing quick diff before staging or committing from a pure feature rich (while not becoming overwhelming) GUI app like Sourcetree (again with window switch).
What I do not like is to do everything code and Git from command line alone. Nope, it's simply not worth it. It's like saying I want to talk using a string telephone and not a mobile or not even just speak out aloud because I need that retro feeling and that's perfectly fine if someone wants that (or if someone doesn't have an option, or it's a specific need).
I don't even want to begin to try CLI for code review. As of now the best I can get are web interfaces (and I hope it gets better - a bigger screen definitely helps), if I need to get more involved I try locally inside my IDE.
I do get that though. I really do. But I don't want to even try. Just like some of my friends get me reading paper books (only) and doing analog photography but they don't even want to try.
Shameless plug: that's why I made CodeApprove (https://CodeApprove.com). I think we can do a lot better than what GitHub offers by default.
You can specify which files with git difftool by adding `-- <paths>`.
What i want is one tab per changed file in my difftool of choice so i can toggle between them with just one click, not having to open-close-open-close all the time.
https://github.com/magit/forge https://magit.vc/manual/forge.html
It allows working with issues and PR/MR from within Emacs.