Better git diffs with FZF

what git diff normally shows you

The good stuff: FZF and how to set it up.

brew install fzf
a basic demo of fzf
fzf --preview 'bat {-1} --color=always'
fzf with bat preview
  • Generate a list of modified files with git diff --name-only
  • Pipe that into fzf
  • Preview the file's diff with git diff --color=always
fd() {
preview="git diff $@ --color=always -- {-1}"
git diff $@ --name-only | fzf -m --ansi --preview $preview
}
# comparing your current branch to master
fd master...
# comparing the changes between two commits
fd 4c674950..6d88a7bfd8
isn’t it nice to be able to use fzf for this?

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Rafael Mendiola

Rafael Mendiola

280 Followers

Startup survivor, drinker of the MIT firehose. React Native developer. geosocial.io is my startup dream. If at first you don’t succeed, sudo bang bang.