Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 930
Ross Bencina Avatar asked May 31 '15 08:05

Ross Bencina


People also ask

How do I tell the difference between two files in GitHub?

The git diff command displays the differences between files in two commits or between a commit and your current repository. You can see what text has been added to, removed from, and changed in a file. By default, the git diff command displays any uncommitted changes to your repository.

Can I compare two files in GitHub?

You can also compare two arbitrary commits in your repository or its forks on GitHub in a two-dot diff comparison. To quickly compare two commits or Git Object IDs (OIDs) directly with each other in a two-dot diff comparison on GitHub, edit the URL of your repository's "Comparing changes" page.


1 Answers

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

like image 68
Rahul Gupta Avatar answered Sep 19 '22 22:09

Rahul Gupta