0 votes
1 view
in Devops and Agile by (25.5k points)

Basically, I don't want to see the changed content, just the file names, and line numbers.

1 Answer

0 votes
by (42.6k points)

If you simply want names then you could use:

git diff --names-only

But if there's no built-in option for this, but it is possible to do this in git, with the help of an "external diff" script.

! /bin/sh

#

# run this with:

#    GIT_EXTERNAL_DIFF=<name of script> git diff ...

#

case $# in

1) "unmerged file [email protected], can't show you line numbers"; exit 1;;

7) ;

*) echo "I don't know what to do, help"; exit 1;

path=$1

old_file=$2

old_hex=$3

old_mode=$4

new_file=$5

new_hex=$6

new_mode=$7

printf '%s: ' $path

diff $old_file $new_file | grep -v '^[<>-]'

Reference:  http://schacon.github.io/git/git.html for GIT_EXTERNAL_DIFF.

Welcome to Intellipaat Community. Get your technical queries answered by top developers !


Categories

...