GitHub for Foreign Language Students
Grammar exercises published as a Git repository on GitHub can be forked by a student and completed on GitHub directly. Yuni, an online teacher of Indonesian, has created such a repository (see the previous chapter ). It contained just a single exercise. Now, after trying things out, she creates a repository with a set of exercises:
Maria, a Yuni’s student, got a link to that repository from her teacher, and is about to do her first homework on GitHub.
Maria creates an account on GitHub , and forks the repository with exercises. This is done with a click on the ‘Fork’ button in the top-right corner of the Yuni’s repository page.
Now Maria has her copy (or fork, in geeky speak) of Yuni’s repository, which she is free to modify. In fact her homework is to modify a file with her first exercise: she has to insert missing words in a text.
Maria is somewhat suspicious of geeky stuff, and decides to solve her homework task directly on GitHub. This doesn’t differ much from just editing text in a web form, except that once she saves the changes, Maria is asked to add a commit message – a sentence describing the changes that were made.
So, Maria types: ‘Completed exercise indonesian_pronouns.md’ and pushes the ‘Commit changes’ button.
Oki-doki, now it’s time to get her exercise checked and possibly corrected. For that, Maria invites a collaborator to her repository. This collaborator is her teacher Yuni, of course.
To invite Yuni as a collaborator, Maria clicks the ‘Settings’ button for her repository, then clicks ‘Manage Access’, then ‘Invite collaborator’ and adds Yuni’s user name on GitHub. Once she submits the form, Yuni will receive her invitation message. Once Yuni accepts the invitation, she will be able to change files and perform commits in Maria’s repository.
After a while, Maria receives an automated e-mail from GitHub telling there’s a new commit in her repository made by Yuni. Maria goes to her repository page on GitHub, and clicks the button saying ‘4 commits’ (the actual number may be different):
This displays the history of all commits made to the files in this repository. She clicks the last one, ‘Corrected exercise indonesian_pronouns.md’. This displays the detailed commit message with Yuni’s explanations, and also shows the differences between Maria’s original version, and the corrected one – a diff, in geeky speak.
The line-by-line diff doesn’t look appetizing for Maria’s taste, so she clicks a page-like icon with a hint ‘Display the rich diff’ (circled in the screenshot above). Much better!
The errors are now highlighted word-by-word, and it looks pretty much like in an office text-editing program. The difference is that Maria is not locked into any particular file format (proprietary or not). Her exercise versions are still just plain texts, meaning it is quite easy to manipulate them. For example, she can convert the diff into a Markdown file and include it in her blog like this:
… Dita: Tina,
kitakami pergi ke Jakarta. Saat kitakami kembali mari kita pergi ke Kesuma restoran.
Tina: Andy dan Ria pergi juga? …
Doing the homework on GitHub directly has its place under the sun: you can do your homework even using a smartphone.
The regular approach, however, is to install Git on your computer (Windows), if it’s not there already (Mac and Linux), to clone your fork of repository with exercises to your computer, do the homework using your favorite text editor, commit the changes, and push them back to the remote repository on GitHub. Once your exercises are corrected, pull from your your remote repository, and review the corrections using word-by word diff.
These steps are done from command line and require some familiarity with Git.
On GitHub repository page, click ‘Clone or Download’ button, and copy the URL:
In your terminal emulator,
# Clone the repository to your computer git clone <REPOSITORY URL> my_exercises # Change to `my_exercises` directory cd my_exercises # Do your homework using a text editor for plain text files. # Stage your changes git add . #Commit your changes: git commit -m '<YOUR COMMIT MESSAGE HERE, MIND THE QUOTES>' # Push your changes to the remote repository git push # Once your exercise is corrected, pull from the remote git pull # Review your teacher's corrections git diff HEAD^ --word-diff=color -- indonesian_pronouns.md # To see more context (or entire file), use -U<NUMBER> option git diff HEAD^ -U99 --word-diff=color -- indonesian_pronouns.md
I strongly recommend to read up about Git instead of just blindly copying the commands. An excellent starting point is a book by Scott Chacon and Ben Straub Pro Git . It is available online free of charge in quite a few languages.