Github/compare: How to diff two different files (different file names, both in HEAD)?

拜拜、爱过 提交于 2019-12-03 14:38:44

问题


Can I use the github /compare to display the difference between two different source files in HEAD?

Here is how I do it on the command line with git diff:

git diff HEAD:docs/tutorial/01-boxed-function-pointers.cpp HEAD:docs/tutorial/02-raw-actors.cpp

My best guess at the github syntax is the following. But it doesn't work:

https://github.com/RossBencina/Fractorp/compare/HEAD:docs/tutorial/01-boxed-function-pointers.cpp...HEAD:docs/tutorial/02-raw-actors.cpp

I specifically want an on-line pretty-printed HTML render of the diff.

If this can't be done with github, can anyone recommend a third-party website that will render diffs of two arbitrary files hosted on github?

Edit #1:

Thanks to the answers who recommended https://www.diffchecker.com. However, I need to be able to specify the source files as current HEAD on github. Any third-party tool would need to automatically pull the latest source files from github repo URLs. I notice that http://www.mergely.com can import source from URLs. However I am looking for a live view that always uses the latest HEAD.

Thank you.


回答1:


I sometimes use Diff Checker tool on the diffchecker website. It is an online diff tool to compare text differences between two text files.

Link: https://www.diffchecker.com/diff




回答2:


I have been using this third party online diff tool for a long time, if you like, you can use it as well. https://www.diffchecker.com. But it seems you should manually paste the two files onto it.




回答3:


Line Diff will display a github like diff between two code snippets, however you won't be able to specify the source files as current HEAD on github - I just think it's an edge case and no one has yet thought of making it a "feature" in one of these online tools.




回答4:


This is a little cheat-y, and you should look into the "premium" options: Hitting a DiffNow endpoint will give you a JSONp callback with the name of a temporary HTML file containing a diff.

https://www.diffnow.com/EdpProcess.aspx?action=compareUrls&url1=https%3a//raw.githubusercontent.com/RossBencina/Fractorp/master/docs/implementing-tutorial/01-boxed-function-pointers.cpp&url2=https%3a//raw.githubusercontent.com/RossBencina/Fractorp/master/docs/implementing-tutorial/02-raw-actors.cpp


来源:https://stackoverflow.com/questions/30555608/github-compare-how-to-diff-two-different-files-different-file-names-both-in-h

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!