GOVT4 Coding

Thesis Workflow Specifics

Working with Git and Github

Github is a web platform, built on the software Git. Git is a software to keep track of changes to your files, and to share these changes with collaborators. A group of files tracked by Git is called a repository.

Git is not dissimilar to tools like Dropbox. But its collaboration model is innovative: the collaboration is distributed rather than centralised. Instead of having one central folder that takes all changes from everybody, git tracks changes locally in ‘commits’. Different histories of commits can exist side by side in one repository, in different ‘branches’, or in different repositories that share a common base (‘forks’). You can decide to pull in changes from other forks and branches. Which fork is considered the main fork is decided only by social contract.

We won’t use all the power of Git this semester. Since everyone will be working on their own thesis, you might not encounter all the collaboration models it has to offer. But what we will use, is Git’s power to archive, as well as an extremely practical feature of Github: to automatically publish the contents of a Git repository as a website.

Publishing HTML as a webpage on Github

You can share projects through Github, but you can also publish to the web. Like with this very page! The repository for this site is at https://github.com/kabk/govt4-coding, the corresponding web-address is http://kabk.github.io/govt4-coding/. To make it work directly from that address, a file index.html is needed in the repository.

Initially, Github’s HTML publishing functionality was meant to host documentation for the code projects shared on Github. That’s why you had to put HTML in a separate ‘branch’ of your code. But now you can simply directly publish your code online.

Getting your HTML onto GitHub

You will need to create an account on the Github site. You’ll also need to download the Github desktop application. If your version of OS X is not supported, you might have more luck with SourceTree. Once you’re set up, send me a message with your username and I’ll invite you to the KABK organisation.

  1. From the KABK organisation, create a new repository by clicking: New Repository.
  2. Your title should follow this pattern: go-theses-18-your-name-the-title-of-your-thesis
  3. Fill in the title and choose ‘Initialize this repository with a README’.
  4. The new repository appears, empty except for a README.md file.
  5. Click the tab ‘Settings’. Scroll down to ‘GitHub Pages’. For ‘Source’, where it currently says ‘None’, select ‘master branch’.
  6. Return to the ‘Code’ tab.
  7. Github for Mac or Github for Windows users can click the button ‘Clone to Desktop’.
    Users of Source-Tree will have to do: menu > Show Hosted Repositories (you might first need to login with your Github credentials). You will see all repositories that are part of kabk. Choose the one you just created, and ‘clone’ it.
  8. Now you have a copy of the repository on your computer. Find the folder, and add files to it. At least add a file called index.html: this will be your home page
  9. In Github for Mac/Windows, new files will show up as ‘changes’. In Sourcetree as ‘Files in the Working Tree’.
  10. To select the new files, in SourceTree drag them up to ‘Files staged in the index’. In Github for Mac/Windows just make sure there is checkbox next to them.
  11. To commit (add the changes to the local repository: first describe your commit with a message. In Github for Mac/Windows you can start typing directly, in SourceTree, first click ‘Commit’. Click ’Commit’ when you’ve finished your description and the change is added to your local history.
  12. To push it to the repository hosted on Github, in Github for Mac/Windows click the ‘Sync’ button in the top right corner—in SourceTree click ‘Push’.
  13. Your page will be online at https://kabk.github.io/go-theses-18-your-name-the-title-of-your-thesis/

Some tips in working with HTML, Git & Github