What is in this article
Git is used extensively worldwide for many type of software and internet and other types of publishing projects (among others). This article provides an introduction to Git and probably the most popular central git repository (GitHub).
Some Publishing Notes
These pages are based on a presentation I created for a group of fellow Makers at the MakerPlace at the Midland Public Library in Midland, Ontario. It is based on, but not a conversion of, a PowerPoint presentation. It would have taken as much work, or more, to convert what I used for the live presentation as I would need to add captions and narration to the videos (which in a web form are easily divided into screenshots with explanations) to satisfy my desire for an accessible website. In addition simply exporting a presentation to HTML5 tends not to be as browser agnostic as I would want.
Version Control and Beyond
Git Ecosystem (Where Git is Used and Why)
Git is Everywhere
Shading map of world with GitHub users and commits by country" caption=“Shading map of world with GitHub users and commits by country Image author: Stefano De Sabbata, license: CC BY-SA 4.0
Why Git is Used
- Used / created for Linux kernel development
- The base technology is both gratis and libre
- Version control and Source Code Management (Managing collaboration)
- Readily available cross-platform tools
- Distributed — users have their own copy
- Normally only changes are pushed or pulled to the ‘remotes’
- Developers are able to modify / enhance Git (as it is open source).
- Fast and light
- Easy branching and merging
Types of Projects (Sample)
- Linux and Cross-Platform Software (Open Source)
- Linux Kernel, XOrg/Wayland, linux-utils, and Embedded Devices (OpenWrt)
- Inkscape, GIMP, LibreOffice, Zim, KeepassXC, VSCode, …
- Web Applications (Open Source & Proprietary)
- Many are based on the Python, Node.js, Ruby, or Golang ecosystems which mostly use Git
- DevOps / IaaS (Infrastructure as a Service); Often In-house
- CircleCI, TravisCI, Jenkins and so on are all oriented towards git-based Continuous Integration and Continuous Deployment
- Packer, Terraform, Ansible, Puppet, and Chef all aim to make infrastructure configuration a form of software
- Websites, and Documents
- Netlify has become very popular for static website generation and publishing; others uses Hugo with old-school deployments or GH Pages
- The Raspberry Pi Curriculum, Awesome Lists, and Open Source Software documentation projects all use Git for collaborating on documents
Why Use Either GitHub or Their Competition
- Git emphasizes collaboration and sharing; central git makes it easy
- Central git services promote Continuous Integration (CI) and Continuous Deployment (CD)
- Allows both public and private repositories hosted on ‘cloud’ servers* Usually have many integrations with other development and project management tools.
- Other developers are more likely to find your project.
- In short they make life easier, especially when collaborating
- GitHub is the best known central git service
- Another two major central git services are: GitLab and Bitbucket
Sign-up is Easy
Just got to https://github.com fill out the form, click ‘Sign Up’ and follow the prompts.
GitHub Provides Learning Materials
screenshot of GitHub welcome screen after sign-up screenshot of GitHub course choices if you go to ‘GitHub Learning’
Git and Visual Studio Code Setup on Windows
- Install Chocolatey – this makes the rest of the installation easier and has added benefits
- Install “Git for Windows”, “Git Credential Manager for Windows”, and Visual Studio Code
- Configure “Git for Windows” & “Git Credential Manager for Windows”
- Add Extensions for Visual Studio Code
- Configure Visual Studio Code
- Test with provided tutorials.
Chocolatey is software that makes it easy to install other software (and remove or update the software you install). If in doubt, check the official install guide at https://chocolatey.org/install
Execute the following in a Administrator PowerShell terminal (right click the start menu icon and select “Windows PowerShell (Admin)”, if you are using Windows 10):
Set-ExecutionPolicy AllSigned -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
Exit the PowerShell terminal
Launch another Administrator PowerShell terminal
choco install chocolateygui
This will give you a graphical interface for using Chocolatey
Install Visual Studio Code, Git for Windows, and Git Credential Manager
- In an Administrator PowerShell terminal
choco install –y vscode git git-credential-manager
Configure Git for Windows (Recommendations)
Execute the commands in a regular PowerShell or Command Prompt
|Use Git Credential Manager for Windows|
|Ignore permissions changes due to Windows filesystem|
|Use Windows line-endings when checking out, and convert the line-endings to Unix-style endings on commit|
|Only “fast-forward” pulls (that means the branch you are pulling into won’t be altered, except the addition of new commits when you pull; you can still “git fetch” and merge if necessary).|
|“Use “Visual Studio Code” as default editor instead of vim or nano (which are harder for beginners to use)|
|Default user information (name) for commits|
|Default user information (email) for commits|
Install Extensions for Visual Studio Code (Recommendations)
Execute the commands in a regular PowerShell or Command Prompt
code --install-extension eamodio.gitlens
GitLens is a useful set of enhancements for working with Git
code --install-extension GitHub.vscode-pull-request-github
Manage Pull Requests from within Visual Studio Code
code --install-extension donjayamanne.githistory
View Git History and manage a git repo in Visual Studio Code
Or you can install them using the GUI after launching Visual Studio Code.
Learn and Use Visual Studio Code
- Next you want launch Visual Studio Code, and read the ‘Welcome’ screen and follow the links that suit what you need to learn.
- Check out Working with GitHub on the Visual Studio Code website.
Learn and Use Git
The VS Code documentation assumes you are already familiar with Git.