DEV Community


Discussion on: Fuzzy branches: a brief example of a git custom command.

yucer profile image
yucer • Edited


Can you make one for "git showtool"?

It would be something like:

git diff tool $REF~1..$REF

moopet profile image
Ben Sinclair Author

I'm not sure how you'd diff those sorts of things. What would you imagine the output would be?

On the other hand, you can use any preview command you like with fzf like

 branch="$(git branch -a | grep -oE '[^ ]+$' | fzf --preview='git show --color=always --stat {}; printf "\n\n"; git diff --name-only {}')"

which would give you a show and then follow it with a list of all the files which differ between the selected and the current branch.

yucer profile image

Sorry for the noise. I found the answer here:

yucer profile image

There would be no output, just the executive of the configured difftool.

Try executing:

git difftool HEAD~1..HEAD

And you will receive the intended behavior for the last commit of the branch.

If you install meld or another well know visual difftool for will recognize it.

Forem Open with the Forem app