Skip to content

Instantly share code, notes, and snippets.

@igrep
Last active December 11, 2015 22:58
Show Gist options
  • Save igrep/4672845 to your computer and use it in GitHub Desktop.
Save igrep/4672845 to your computer and use it in GitHub Desktop.
maybe useful when you want to try your committed vimscript on your vim
#!/bin/bash
# maybe useful when you want to try your committed vimscript on your vim
# WARNING: as written, this script doesn't backup the destination directory
GIT_PAGER=cat
PAGER=cat
updated_files=$(git diff --name-only master)
dest_dir=$1
if [ ! $dest_dir ] ; then
echo specify path to install!
exit 1
fi
IFS=$'\n'
for src in $updated_files ; do
dest=$dest_dir/$src
if [ -e $src ] ; then
dest_parent=$(dirname $dest)
if [ ! -e $dest_parent ] ; then
echo mkdir -p $dest_parent
mkdir -p $dest_parent
fi
echo cp $src $dest
cp $src $dest
else
echo rm $dest
rm $dest
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment