Pacific-Design.com

    
Home Index

1. Git

2. vimdiff

Git / vimdiff /

Use Git vimdiff without any configuration

$ git difftool --tool=vimdiff --no-prompt

Use Git vimdiff with global configuration

$ git config --global diff.tool vimdiff
$ git config --global merge.tool vimdiff
$ git config --global difftool.prompt false

Editing Changed Files

$ vim -p `git diff --name-only`

Automate git with vimdiff (eg., "$ diff pom.xml 2" )
function diff() { 
  clear
  x=0
  VAR2=`git log  $1 | grep commit | awk '{ print $2 }'`

    for line in $VAR2
    do                                                                                                                                                                                     
         let x++
         echo "$x. $line"
         if [[ ( "$x" == $2 ) ]]; then
            echo "git difftool $line $1" 
            git difftool $line $1 
         fi
    done
}