davidar / pandiff

Prose diffs for any document format supported by Pandoc
MIT License
295 stars 24 forks source link

Add support fot git vcs #4

Closed hason closed 5 years ago

hason commented 5 years ago

I would be nice to add support for files in git repository:

# diff actual working copy with the last commit in actual branch
pandiff path/to/file.md 

# diff actual working copy with the version in tag/brach/commit
pandiff path/to/file.md <tag/brach/commit>

# diff version of file in tag1/brach1/commit1 with the version in tag2/brach2/commit2
pandiff path/to/file.md <tag1/brach1/commit1> <tag2/brach2/commit2> 
davidar commented 5 years ago

It should already be possible to do this by configuring git-difftool:

git config --global difftool.pandiff.cmd 'pandiff "$LOCAL" "$REMOTE"'

Then you can do things like:

git difftool -t pandiff de4460f 3742cc2 README.md

Does that work?

reagle commented 5 years ago

Could you put this in the README.md? Also, it'd be handy to have a suggestion of how to avoid the warning prompt when using git so you can redirect the output.

Viewing (1/1): '1-08-forsyth.md'
Launch 'pandiff' [Y/n]? Y
davidar commented 5 years ago

It should already be there: https://github.com/davidar/pandiff#git-integration

I've updated the instructions to avoid the prompt.

reagle commented 5 years ago

Thanks!