Reputation: 448
I create a tutorial, where I want to introduce some testing frameworks like Mockito, WireMock and EasyMock. I want to explain it step by step. Additionaly I want to provide examples, where the reader of the tutorial can try to recreate these. Therefore I want to to give them the opportunity to look into my source code and use it when they are not able to recreate the test. And then they can use the actual version to continue and then again, when they are not able to create the next test, I want to to give them the possibility to use my new version with the new test.
My idea is to use different commits and link them to the tutorial. How can I do this or is there any better approach to reach what I just explained?
Upvotes: 1
Views: 5314
Reputation: 15030
Easy Peasy!
The basic approach is this: browse to exactly what you want on GitHub, and then share the URL. GitHub URLs are stable permalinks, even when you navigate to an old revision or another branch.
Commits
at the top of the files listing. This will take you to a page showing all the diffs. (You can share this URL if you want. Otherwise continue to the next step.)Browse files
in the upper right corner. ...
button that appears next to it and then click Copy permalink
shift
key and clink on the other end of the range of lines. The lines will be highlighted. Click on the ...
button that appears next to it and then click Copy permalink
All that said, unless you are walking them through your many iterations of the code, I'm not sure giving them links to versions in git history is the way to go. Let's say they want to clone your repo. Then they'd have to git checkout example-2-version-3
or something.
The more typical approach is to put the different versions in a directory hierarchy, making it far easier to browse, whether on GitHub or a local clone of your repo.
Upvotes: 2