DEV Community

loading...

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

Collapse
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.

Collapse
yucer profile image
yucer

Sorry for the noise. I found the answer here:

stackoverflow.com/questions/348853...

Collapse
yucer profile image
yucer

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