8

I've got a collaborator that's not GH-friendly and not likely to become so in the near future.

I'd like to show him line-by-line the changes I've made to a paper, and the commit comparison is the perfect way to do so.

But they've no account and the repository is (and will remain) private.

Is there any way to export the track changes log from GitHub to another format which could be sent to my collaborator more readily?

1
  • What tool are you using to write the paper? Depending on the format, a dedicated diff tool may help. If LaTeX, I'd recommend git-latexdiff (warning: I'm the author ;-) ). Commented Aug 17, 2016 at 8:18

4 Answers 4

5
+100

So for the colored output you need some additional tool like aha - it's ansi to html adapter. The final version might look like this. git log -p -n 2 --color=always | aha --black > output.html

Sign up to request clarification or add additional context in comments.

6 Comments

this looks like it sort of might be a help but I can't really understand what I'm seeing; I also strongly prefer something which colors additions and juxtaposes them next to deletions, for clarity to the reader.
So maybe git log -p - it shows all commits history with changes.
that's much better! any ideas for how i might color the output (I used git log -p > changes.txt)? and to restrict the number of commits included
If you want to restrict number of commits pass just options -n your_number. Regarding coloring, it might be harder, because it's done by shell and you need some more tool than simple output redirection. I used linux tool called aha. Install it and then try this. git log -p -n 2 --color=always | aha --black > output.html Now you have it all in html file - in colors.
git log -p --color-words may help too.
|
1

If you like the GitHub diff, you can view it on GitHub from your browser, use your browser's "save page" to get an HTML file to send to your collaborator.

To get an all-in-one diff from GitHub, append /compare to the URL of your repository (more details GitHub's documentation). Then pick the view you like, and save it to HTML.

6 Comments

That sounds good, but I just tried this and the resulting HTML file was a disaster.
I tried too, using Firefox and the resulting HTML worked. You have to send both <filename>.html and the <filename>_files/ directory to get the CSS & other things needed by the page.
Seems like a pain to make collaborators be sure they have the correct directory structure to view my diff...
They won't notice there are several files if you send a .zip files. But you can also inline everything into a single HTML file. There seem to be extensions to do that in Firefox and I sometimes use npmjs.com/package/html-inline. But then, it's really a web/HTML question, not a Git one anymore.
Not fighting for points ;-). I added this answer because it answers best the "GitHub" part of your question, but I personally prefer @grimsock's version too ;-).
|
0

You can add .patch to any valid /{org}/{repo}/compare/{revision range} link to get a log-like output with commit metadata and diffs, e.g. https://github.com/dahlbyk/posh-git/compare/5ed5c05...c39da78.patch. You can also add .patch to any single commit, e.g. https://github.com/dahlbyk/posh-git/commit/c39da78.patch.

Comments

-2
git diff --color > file.txt

Open file in Sublime

2 Comments

You should provide more context in order to improve your answer.
this only shows the diff for non-commited files. It appears the OP is asking commit based changes.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.