Git is a mature, actively maintained open source revision control system used by thousands of developers around the world.
Created by Linus Torvalds, the father of Linux.
Because in a real-world scenario you don't code by yourself.
You need tools in a team to efficiently collaborate on code.
Git allows you to rollback changes, branch out on different forks to test code ideas, whilst making it easy for people to share code.
Git repository hosters like GitHub also serve as a cloud-based backup for your code, and also to easily deploy them.
There are tons of other Git hosters like Bitbucket, GitLab amongst many others.
GitHub is one of the most popular free Git repository sites (now owned by Microsoft)
It is a sort of Linked-in for developers, but also way more than that.
For this bootcamp we'll be using GitHub to show how to collaborate and deploy projects.
Please go to the web platform and sign up for an account.
For your local development machine, you can install Git for the command line.
The Git functions that you need to know are probably just clone, pull, push, commit and branch.
However, in this bootcamp we're going to use an even easier to use higher order GUI (graphical user interface).
We'll be using Github desktop, just one of many GUI Git clients out there.
GitHub Desktop integrates well with Visual Studio Code editor. Please download a version of GitHub desktop.
Documentation for GitHub Desktop is excellent, and you can find it here.
The bootcamp materials and my visualization course is in a publicly accessible GitHub repo.
Going to step through on how to clone this using GitHub desktop.
Because if the repository is constantly updated and worked upon, you will get a notification that there are new commits or changes to the project.
This might be useful if you're tracking a project or repository that is constantly updated (like my module during the semester!)
Another common use case is if you're working with other people on a project together.
You can download and read from this open repo.
You do not have write permisions though to commit to and change the repo.
We'll step through a collaborative project later, but let's tackle a solo repo first.
Create a test repo on the GitHub platform and clone it.
On your local machine, create an text file called helloworld.txt and commit this to the cloud version of your repo.
Stepping through the nuances of the local client.
As long as you work on different files, Git automatically merges them into the repo.
But there is not one version of truth - what if two of you work on the same file and push different content?
Let's step through conflict merge resolution.
Another really useful function is creating branches from the main code tree.
The idea is that you can create a branch of the tree to try out new ideas. Now when people work on the main trunk or other branches, your branch is not affected.
Eventually the idea is that you merge the branch back to the main trunk when ready.
All these features become a lot more useful when you scale developer teams.
GitHub allows deployment of projects using their feature Git Pages.
This is just a webhook that does automatic deployment after commit.
There's lots you can do with webhooks - trigger scripts to run servers, do testing, etc.
This is known as CI/CD, or continuous integration / continuous deployment in the industry parlance.
Let's try a simple version!
Deployment of projects is one main reason why I wanted to use GitHub, beyond a plethora of other good ones.
I also like Sourcetree, which is another free Git GUI client.
It has some useful functions, notably a graph view of the repo changes.
There are tons of other Git GUIs like TortoiseGit, GitKraken, etc. Pick one that you like!
Remember the data code merge we did on day 2?
Here's a version of a Leaflet visualization that uses that data.
Can you copy this visualization and publish it to your test repository?
You also need the JSON subdistrict data and population CSV data.
This is what assignment 4 asks for in my module. However this is done using mainly Leaflet, not D3.
Chi-Loong | V/R