Live data from Hacker News

Git-appraise – Distributed Code Review for Git

github.com

61–70 of 173 posts

Re: Git-appraise – Distributed Code Review for Git

#61
post #44

I have this "one weird trick" that I think is great, but somehow no-one else wants to use: At one point I worked with a fellow dev where we did PR reviews just as commits on top of the branch. So you'd check out their feature branch, run the equivalent of 'compare working tree with ' for your editor and then look through the changes. Because you're comparing the working tree you can leave comments... by typing source…

Have you ever tried the git e-mail workflow? I think you may like it, I'd be curious to have your opinion about how it compares to your workflow above :-).

The idea is that you just send your patch by e-mail, and the reviewer just applies it with `git am `. So you don't even have to sync on a branch. Then the reviewer can comment directly on the patch. You answer with new versions of the patch, and get new reviews. It's minimal, actually decentralized (unlike, say, GitHub), and I believe it has the advantages of your workflow above.

Nice posts about it:

https://drewdevault.com/2018/07/02/Email-driven-git.html

https://drewdevault.com/2022/07/25/Code-review-with-aerc.htm...

Re: Git-appraise – Distributed Code Review for Git

#62
post #24

Storing code review (and ci results, and analyzer runs) in git is a wonderful idea. All these workflows are a derivation of the source in the repository and keeping them close together has a great aesthetic. It also enables the 'single pane of glass' to observe the a pull request from.

Same with things like issues and discussions, the only trouble is that it creates a lot of commits and possible churn. Which can be alleviated by storing the comments in a separate branch (so it doesn't affect the mainline), but even then the repo will get very big very fast.

But that may be a future problem, after all, removing a branch from a git repository (and its history) is fairly straightforward.

Re: Git-appraise – Distributed Code Review for Git

#63
post #44

I have this "one weird trick" that I think is great, but somehow no-one else wants to use: At one point I worked with a fellow dev where we did PR reviews just as commits on top of the branch. So you'd check out their feature branch, run the equivalent of 'compare working tree with ' for your editor and then look through the changes. Because you're comparing the working tree you can leave comments... by typing source…

The core problem with this workflow is that it's rigid around doing things The One True Way. The fact that you have a specific comment delimiter is a good example of that. I feel like this doesn't really have any upsides compared to, say, reviewing code on Github. If you want you can always check out the branch and inspect it locally, but you also have the option of doing it all on the web without stashing your changes if the change is not large. Many online review tools also support go to definition, suggesting code changes inline, etc. All of this means more flexibility, everyone can review the way that works for them, not just The One True Way.

Re: Git-appraise – Distributed Code Review for Git

#64
post #23

TIL there's git notes https://git-scm.com/docs/git-notes

is quite useful when you do some thing and want to notifiy your future self why you did things the way it is instead of comments you can use notes. Also you can generate metrics with notes if all commits are attached with notes.

Re: Git-appraise – Distributed Code Review for Git

#65
post #44

I have this "one weird trick" that I think is great, but somehow no-one else wants to use: At one point I worked with a fellow dev where we did PR reviews just as commits on top of the branch. So you'd check out their feature branch, run the equivalent of 'compare working tree with ' for your editor and then look through the changes. Because you're comparing the working tree you can leave comments... by typing source…

The core problem with this workflow is that it's rigid around doing things The One True Way. The fact that you have a specific comment delimiter is a good example of that. I feel like this doesn't really have any upsides compared to, say, reviewing code on Github. If you want you can always check out the branch and inspect it locally, but you also have the option of doing it all on the web without stashing your chang…

Hmm I don't fully agree with this. By using the PR workflow on GitHub, your One True Way is that people need to create an account on GitHub and use their web interface to make the review.

You always have to enforce some kind of conventions, but I wouldn't say GitHub is the most flexible. With an e-mail workflow, everyone can use the e-mail client they want and review the patches the way they want, without being forced to sign up on a website at all.

Re: Git-appraise – Distributed Code Review for Git

#66
As a sort of spiritual successor to git-appraise, I've been working on git-bug[1] which support issues and will at some point support kanban and code review. There is a few notables improvements:

- CRDT-like reusable data structure [2][3] for true p2p workflow and easily create new entities (code review ...)

- bidirectional bridges to github, gitlab ... to ease the transition or just use git-bug as a complement of those platform

- CLI, terminal UI and web UI, for different taste and integrate into your tooling/workflow

[1]: https://github.com/MichaelMure/git-bug

[2]: https://github.com/MichaelMure/git-bug/blob/master/doc/model...

[3]: https://github.com/MichaelMure/git-bug/blob/master/entity/da...

Re: Git-appraise – Distributed Code Review for Git

#67
post #44

I have this "one weird trick" that I think is great, but somehow no-one else wants to use: At one point I worked with a fellow dev where we did PR reviews just as commits on top of the branch. So you'd check out their feature branch, run the equivalent of 'compare working tree with ' for your editor and then look through the changes. Because you're comparing the working tree you can leave comments... by typing source…

> you share the review by pushing to the branch.

How do you deal with conflicts between multiple reviewers?

Re: Git-appraise – Distributed Code Review for Git

#68
post #44

I have this "one weird trick" that I think is great, but somehow no-one else wants to use: At one point I worked with a fellow dev where we did PR reviews just as commits on top of the branch. So you'd check out their feature branch, run the equivalent of 'compare working tree with ' for your editor and then look through the changes. Because you're comparing the working tree you can leave comments... by typing source…

You're not crazy and not alone. At Hydraulic we do the exact same thing. It has other advantages you didn't mention:

• It yields much more collaborative code reviews, because for small tweaks it's quicker to just fix the thing you want changed than ask someone else to do it. After all, you've already got the code checked out and in your IDE. This is especially true when working with easily refactorable languages like Java or Kotlin and IDEs with great diff viewing support like IntelliJ, because if you don't like the symbol name someone picked you just change it. No need for a round-trip. This is huge because it stops reviewers/reviewees getting exhausted from "nitpicking" and fosters teamwork.

• You can see the IDE's static analysis outputs, which you won't see in a web based PR viewer. This can often let you spot bugs that might otherwise escape notice.

• You can easily run the unit tests, or add a quick test if you notice it's missing. If it fails, no problem, just commit the failing test, push and let the author know that they have more work to do.

To implement this workflow we use Gitolite on our "HQ" server that we use for everything. Everyone gets their own UNIX user and their own personal git clone of the product repos. Access controls are in force, so if you want someone to review something you push it into their repo but it has to be under a branch named rr/$PUSHER_USERNAME/change-name. So your PR queue is visible in your IDE's git branch explorer. Do a fetch and new work shows up to review, add commits or merge it and then delete the branch to close the review. The merge preserves the history of the review session.

We have it wired up to TeamCity and YouTrack (yup, I'm a JetBrains fan). Everyone also gets their own private TeamCity project. The combination of this means that devs can push private branches to get things nice and clean in CI without disturbing anyone else or polluting their UIs - there are no "draft PRs" or other self-contradictory concepts in this workflow. Ownership of branches is always crystal clear also, even for experimental branches or projects. Once a PR is merged into the tech lead's master branch, YouTrack notices the commit has gone green there and parses issue update commands out of the commit message, finally updating or closing the ticket automatically.

Note that this setup is cheap for small teams. TC and YouTrack are free for small setups, Gitolite is open source, all you need is a server. We pay 90 EUR a month for a dedicated machine at Hetzner that has 128 GB of RAM and 2TB NVMe flash, and everyone gets a UNIX user, so if you want to do remote dev on it or host random files you can do so and it's extremely fast.

Socially this arrangement is kernel-like. The tech lead of the project runs the repo from which releases are done and merge in from teammates, which in turn can merge in from their teammates and so on. Ownership is always clear because the act of merging is also the act of taking responsibility. You can't get a tragedy of the commons where juniors keep picking other juniors to review their work like you can in more conventional free-for-alls.

Re: Git-appraise – Distributed Code Review for Git

#69
post #24

Storing code review (and ci results, and analyzer runs) in git is a wonderful idea. All these workflows are a derivation of the source in the repository and keeping them close together has a great aesthetic. It also enables the 'single pane of glass' to observe the a pull request from.

I assume it would also have the advantage of not tying the code reviews and PRs to a proprietary git provider. Say I move from GitHub to GitLab, I assume I lose all the PR descriptions and comments people have made over the years and only keep the commit messages. It would be nice to have a provider-agnostic representation of this data.

> It would be nice to have a provider-agnostic representation of this data.

Isn't the (original) e-mail workflow exactly that? Git was designed for it.

Re: Git-appraise – Distributed Code Review for Git

#70
Reading the comments, I am quite surprised to see no mention of the git e-mail workflow. Git was designed for it, but somehow it seems like it has been completely forgotten.

Drew Devault has nice posts about it:

https://drewdevault.com/2018/07/02/Email-driven-git.html

https://drewdevault.com/2022/07/25/Code-review-with-aerc.htm...

Post reply on HN