Git + GitHub
Introduction to the fundamentals of git and GitHub.
Designed by: Stazia "WigginWannabe" Tronboll

Introduction

If you have ever worked with anyone on a school coding assignment over some electronic source code files without being in the same room together you have probably incurred problems. If you were trying to share files, you probably emailed them. Surely, they sent you an updated version of the same file(s) with the same name. When you save it onto your computer you have the option to override the existing file or give it a new unique name. Whatever choice you made, there may have been some information from the old file you wanted to keep. And although there may be a copy floating around somewhere in your email, you can see how this is already becoming complicated. Fortunately, there is a solution to all this madness with source code management.

Enter git and GitHub. Git is a source code management software that maintains version control through a repository. GitHub is a cloud-based tool that allows you to synchronize your local git repository with the local git repositorys of your colleagues and a remote (cloud) respository kept by GitHub.

Git and GitHub allows for collaboration and makes collaboration seamless by saving snapshots of you and your colleagues work in a clean, easy, and efficient way. These tools work best with traditional code (e.g. C/C++, Java, Python, Javascript, etc.), however can work for non-traditional file formats as well. This makes the source code available to all collaborates anywhere at any time reducing any overhead involved emailing or sharing code any other way.

Furthermore, source code management is a necessary and required skill for any industry position. It may not necessarily be git, but source form of good version control is enforced. It is also important for working with large teams as will be done at any company large or small that has any project with software.

This tutorial is your introduction to git and GitHub which are used together to introduce you to source code management, version control, and team collaboration. We cover the most fundamental concepts to get you started using these tools in your next projects!

Overall Learning Objectives

Download + Install Git
Create GitHub account
Understand git workflow
Initialize git repository
Git commands:
add
commit
push
log
checkout
Sync local git repository to remote GitHub repository

Required Tools and Equipment

Laptop Computer
Wireless Network Connection

Required Downloads and Installations

[Windows] git + Git Bash: https://git-scm.com/downloads

01 Download and Installing git

Objective

In this module, we will go over what you need to be ready to use git across any of the popular operating systems (Windows, Mac OS X, and Linux).

Download and Installing git

Let us install git so we can git started using source code management:

[Linux] Installing and Updating git

For most Linux based operating systems, git may already come pre-installed. If it is not installed, then like most installations in a Linux environment, the following should install git:

sudo apt-get install git

[Mac OS X] Installing git

Launch the Terminal.

To check whether you have git installed or not, simply type the following command in the Terminal:

$ git --version

If you get the following response, you have git installed and you are good to go. It also relays your current version of git that you have installed.

On the other hand, if you get the following response, then you need to install git - and your Mac will automatically take you through the process to install the command line developer tools.

The following should pop-up at the same time as the previous message in the Terminal:

To only install git, click Install.

You will need to read and agree to the Command Line Tools License Agreement.

After a few minutes, the git installation will complete. You will need to close your current window of Terminal and launch the Terminal again.

Then type the following command into the Terminal:

$ git --version

If you get the following response, you have git installed and you are good to go. It also relays your current version of git that you have installed.

[Windows] Download and Installing git + Git Bash

By default, Windows does not come pre-installed with git. Furthermore, Windows does not have (a good) shell, or Terminal, like Linux environments have by default. We will definitely want this shell, and when we download git we will obtain Git Bash. This will be the shell that we we will use to do all our source code management.

To install git + GitBash, visit the following Git SCM web page and download the the latest version of Git for Windows:

The link should automatically detect and initiate the download. If not, simply chose the appropriate installer for your system.

After the download is complete, navigate to your Downloads folder, or wherever you downloaded the installer. Launch the installer.

After launching the installer you may be prompted a couple times. The first is a security warning:

Click Run to continue.

You may be prompted by the User Account Control. Click Yes to accept and continue.

You will then follow a series of prompts. Most of them can be taken by default, we make a few changes that we found useful and illustrate the steps taken.

If you know what you are doing feel free to follow the installer with your own custom installation.

Accepting the license agreement:

Selecting Git installation destination:

Selecting components. We do NOT recommend the Git GUI. Using the Git Bash CLI (command line interface) is how you shouild use git. We additionally added the Check daily for Git for Windows Updates.

Default Settings
Modified Settings

Select Start Menu folder:

Choosing default editor:

Adjusting PATH environment. We recommend NOT using git in the Windows Command Prompt and to use git exclusivly with Git Bash.

Default Settings
Modified Settings

Choosing HTTPS transport backend:

Configuring the line ending conversions:

Configuring the terminal emulator to use with Git Bash:

Configuring extra options:

And that should do it for the configurations. We now install git + Git Bash. Should not take longer than a minute.

When complete, feel free to view the Release Notes and even Launch Git Bash. We should how to launch Git Bash in a moment.

When using Git Bash on Windows, the suggested method is to navigate to the folder you wish to use git in or where you still start your git repository and right-clicking the Desktop or folder in Windows File Explorer. You will be given several options, one of which should be Git Bash Here, which will launch the following Git Bash shell:

And that is it to get git + Git Bash installed on Windows!

02 Introduction to Git + GitHub

Objective

In this module, we assume you have git installed on your local machine and a GitHub account already created. Now we demonstrate and teach the fundamentals of using git + GitHub for source code management!

Introduction to Git + GitHub

Conclusion

We hope you have grased some of the fundamentals of Git and GitHub as a tool for source code management, version control, and team collaboration. We have only covered a small subset of the numerous and powerful tools that these tools provide for users.

There are many intermediate and advanced concepts to further enable and empower you in your projects. These include: branches, merging, and resolving merge conflicts.

Regardless, to become comfortable and fluent using git and GitHub you have to start using it. It may feel weird to use it at first, but we find us using it for everything when applicable. It makes working even alone on projects very easy when transfering to a different computer or even as a backup for your files! So go forth and start using git and GitHub anywhere you can and you will naturally find yourself exploring the more intermediate and advanced tools to increase your productivity. Now, git goin' Nerds!