Waylon Walker
Posted on December 10, 2021
I often review Pull requests from the browser as it just makes it so easy to see the diffs and navigate through them, but there comes a time when the diffs get really big and hard to follow. That's when its time to bring in the comforts of vim.
Plugins needed
This all stems from the great plugin by AndrewRadev. It breaks a down into a project. So rather than poping into a pager from git diff, you can pipe to diffurcate and it will setup a project in a tmp directory for you and you can browse this project just like any other except it's just a diff.
Plug 'AndrewRadev/diffurcate.vim'
My aliases
First to quickly checkout PR's from azure devops I have setup an alias to fuzzy select a pr and let the az
command do the checkout.
alias azcheckout='az repos pr checkout --id $(az repos pr list --output table | tail -n -2 | fzf | cut -d " " -f1)'
Next I have a few aliases setup for checking diffs. The first one checks what is staged vs the current branch, the others check the current branch vs main or master.
alias diffstaged="git diff --staged | nvim - +Diffurcate '+Telescope find_files'"
alias diffmain="git diff main.. | nvim - +Diffurcate '+Telescope find_files'"
alias diffmaster="git diff master.. | nvim - +Diffurcate '+Telescope find_files'"
diffcommit() {
git diff $1 | nvim - +Diffurcate '+Telescope find_files'
}
Links
Posted on December 10, 2021
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.