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.
- From the KABK organisation, create a new repository by clicking: .
- Your title should follow this pattern:
go-theses-18-your-name-the-title-of-your-thesis
- Fill in the title and choose ‘Initialize this repository with a README’.
- The new repository appears, empty except for a README.md file.
- Click the tab ‘Settings’. Scroll down to ‘GitHub Pages’. For ‘Source’, where it currently says ‘None’, select ‘master branch’.
- Return to the ‘Code’ tab.
- 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 ofkabk
. Choose the one you just created, and ‘clone’ it. - 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 - In Github for Mac/Windows, new files will show up as ‘changes’. In Sourcetree as ‘Files in the Working Tree’.
- 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.
- 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.
- 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’.
- 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
- One of the great advantages of Git is that it stores versions for you. Therefore you don’t need to store versions in separate files like this:
file_version1.html
,file_version2.html
,file_finalversion.html
,filefinfinalversion.html
. Everyt time you commit, Git automatically stores the difference with the last version of the file you commited. - The internet is case sensitive.
Kabk.gif
andkabk.gif
are seen as two different files. When making links etc. you have to be consistent. Web developers often choose to use only lowercase filenames to avoid possible confusion. It is also best to not use accents in filenames, and to replace spaces with underscores. - Your public website can be indexed by Google. If you prefer to keep it off Google while it is a work in progress, you can add the following code somewhere near the top of your HTML page:
<meta name="robots" content="noindex">