0

enter image description here

While running git diff something similar to the image above shows up which takes a lot of screen space and makes it hard to read the new file. Is there some way to prevent the first screen from showing up on the new file while doing the diff?

Prathik Rajendran M
  • 1,152
  • 8
  • 21

2 Answers2

0

You can specify --diff-filter=a on the command line to filter out all file additions, you won't see new files at all, or you can tell vim to show only the window you're in with control-W O (for window control, only window) once vimdiff is up. Try :help windows for help on vim-window-related things generally.

jthill
  • 55,082
  • 5
  • 77
  • 137
0

You can write a script which ignores /dev/null and call it using extcmd option of difftool

Script diff.sh

if [ "$1" = "/dev/null" ]; then
  vimdiff "$2"
elif [ "$2" = "/dev/null" ]; then
  vimdiff "$1"
else
  vimdiff "$1" "$2"
fi

Command for difftool

git difftool --extcmd=path/to/script/diff.sh
Saurabh P Bhandari
  • 6,014
  • 1
  • 19
  • 50