GitHub Foundations

Discovering the GitHub collaboration platform

Please note: This class and curriculum have now become a part of the two day GitHub for Developers course.

GitHub Foundations

Core skills for day-to-day use of Git on the command line and GitHub workflows



Understanding version control

Explore an introduction to core concepts of the Git technology and its vocabulary for every-day scenarios.



Git logo



Distributed version control



What is a commit


Lab
  1. Launch Terminal or Git Shell
  2. Check Git installation with git --version
  3. Launch GitHub for Desktop

Objectives

Git key vocabulary & concepts

Three important words key to learning Git are:

Git is an open source distributed version control system invented by Linus Torvalds in 2005. It is used to version the Linux kernel and is shown to be, by some research, the most popular modern version control system.

Three important concepts of this version control system are:

Deeper study

Installers

The command line version of Git has a very light footprint. For most platforms, you can simply copy the binaries to a folder that is on the executable search $PATH. Git is primarily written in C, which means there is a unique installer for each operating system.

Videos

What is Git?


Surveying the GitHub platform

Discover the flexibility of preserving version controlled files and the simplicity of collaboration workflows all in one ecosystem.



GitHub logo



Repositories



Branches



Pull Requests



Issues



Organizations



Teams


Lab
  • Describe the difference between the Git DVCS and GitHub collaboration platform
  • Access the common project components of daily GitHub interactions
  • Utilize project management components (Issues, Milestones, Collaborators, Teams)
  • Recognize best document types for version control (code, CSV/TSV, small binaries)

Core concepts

The six core concepts in the GitHub ecosystem are:

Feature overview

Details & resources

GitHub accounts are free. Sign up for one at github.com/join.

GitHub is the repository hosting, collaboration, deployment, and distribution platform for both open source and private software projects. It facilitates discussing changes-in-progress through the concepts of Issues and Pull Requests and provides a web user interface to much of Git. The web flow made possible by GitHub brings a much wider range of contributors, including documentation specialists, designers, and ops engineers into the flow of contributing to your application’s life cycle.

GitHub accounts are free for an unlimited quantity of public repositories. Only private repositories cost to host on the service. Private repositories are typically used for closed-source consulting client or corporate products, whereas public repositories are typically used for open source.

Sign up for a free GitHub account at github.com/join.

Videos

GitHub account creation video


Creating a hosted repository

Publish your versioned documents and share projects on the GitHub platform.


Lab
  • Visit GitHub.com
  • Click the +
  • Name the repository
  • Choose seed files
  • Discuss ways of interaction

Details

Repositories can be created in numerous ways, including:

An important decision when creating your repository is in its name. Giving it a human readable, quick-to-identify, and sensible name makes it most effective and efficient for both yourself, and your colleagues to understand.


Touring content versioning on GitHub

Explore the GitHub Web Flow and GitHub interface that provides robust Git version control actions all through a web browser.


Lab
  1. Browse to one of your repositories
  2. Create file(s) and commit the new content
  3. Edit an existing file’s content and commit the change
  4. Remove a file and commit the removal
  5. Change a filename and commit the path change
  6. Examine the Commits page of change history

Details

The GitHub web interface allows you to interact and perform many file-affecting actions directly through your browser:


Acquiring repositories locally

Explore the process of downloading a hosted repository to a local machine, the support across tooling, and the options of protocols.



Repository clone process


Lab
  • Clone from web (Clone in Desktop button)
  • Clone via personal repo list in GitHub Desktop
  • Clone via SSH or HTTPS URL

Details

A commit is a transactionally grouped set of changes, described by a brief message explaining the “why” of the attached changes.

git status
git add [file]
git commit -m"[description]"

Git enables repositories to be created both on GitHub, or locally on a developer’s computer. A repository created locally can be synced to a network destination at a later time, preserving all the timestamps and comments in the local commits during the synchronization.

Since Git facilitates making and saving changes without a network connection, syncing changes with an upstream server is a frequent operation once connected back to a network. Git accomplishes the syncing through the pull and push commands.

A repository must have fully incorporated all upstream changes before it can successfully push changes out. This pattern encourages breakages to happen at the leaf nodes of the repository network, thus reducing stop-work merge activity and aiding those tasks being performed asynchronously and potentially even offline.

To retrieve all upstream changes, and then transmit all local changes, type:

$ git pull
$ git push origin [master|branch]

Local repositories offer several benefits:

Just as with the Git technology operating on GitHub, local repositories also use two identical aspects: Commits, which serve as history marker for file(s) and change(s) with a record of author, time, and message; and Branches, which serve as a container for grouped commits, making simpler means to integrate change with cleaner code review possibilities.


Exploring the GitHub Flow

Discover the simplicity and flexibility in Git-based collaboration workflows with context-specific sets of changes and code review via Pull Requests



What is a branch

What is a branch


Lab
  1. Using the GitHub web UI, create a branch with an articulate feature name
  2. Make two distinct commits to the branch, each contributing part of the feature’s changes
  3. Return to the homepage of the repository by clicking the repository’s name
  4. Notice the suggestion message asking if you’d like to “Compare and Pull Request”
  5. Click on Compare and Pull Request
  6. Describe the reasoning behind the changes on this branch via the Pull Request
  7. @mention a team or colleague, asking for a code review
  8. Address the points raised by the reviewers through an additional commit to the branch
  9. Ask for a final review and :+1: from a colleague
  10. Merge the Pull Request

Details

The GitHub Flow is a path through the GitHub user interface that facilitates governed, named, and reviewed sets of changes. This flow can be performed entirely from a web browser, with no need to download the code to a desktop machine, and yet still have the benefit of syntax highlighting and pre-merge code reviews and discussions.

A branch is a divergent path in the history of the code base. It may contain an experiment, fix, or enhancement, and is generally intended to be merged back to the master branch after being thoroughly reviewed by a colleague.

Videos


Contributing with Forks & Pull Requests



Fork contribution pattern


Lab
  1. Create a Fork of a repository needing contributions
  2. Follow the contribution pattern of the GitHub Flow, with the branch creation and commits happening on your fork of the repository
  3. Observe the Network and Members graph that offer visualizations of your commits and fork
  4. Merge the Pull Request
  5. Observe your contributions in the original repository, having preserved your username as the author of the code

Resources


Syncing local and GitHub repos

Publish and synchronize local commit history with a GitHub hosted repository from graphical clients and command line.



Distributed repository interactions


Lab
  1. Clone an existing GitHub repo using the GitHub for Desktop application
  2. Following the GitHub Flow pattern, create a topic branch and make commits to the local repository
  3. Review the local (unsynced) commits in history
  4. Publish the changes via the Sync button
  5. Verify the presence of the now-synced changes by refreshing the GitHub web UI of the cloned repo

Details

In many cases, working with a code project means retrieving it to the local disk so that you can leverage your language-specific IDE when making changes. To retrieve a repository to the local disk is to clone it, in Git parlance.

Optionally, the process of synchronizing can be done on the command line, in addition to graphical clients like GitHub for Windows and GitHub for Mac:

# Retrieve GitHub changes
git pull origin [master|branch]

# Publish local changes
git push origin [master|branch]

Visualizing changes with GitHub

Identify changes across document history through GitHub’s interface and support for code, prose, graphics files, and more.


Details

GitHub enhances a traditional Git experience with visualizations typically thought of as the realm of desktop applications. Some of the visualizations we can look at today include:

Image Diff

Image diffing is typically thought of as a desktop-oriented feature. However, GitHub aims to be a web application that performs beyond desktop apps, and provides a rich 2-up, swipe, and onion skin view for changed images.

Similarly, 3D file viewing, and then 3D file diffing are also part of the GitHub platform, providing a surprisingly rich experience right in the browser.


Using GitHub Pages

Craft, version, and publish GitHub-hosted web pages directly from a project repository.



Managing projects

Identify pending contributions, manage collaborator and permissions access, and curate flexible task lists of project objectives.



Using GitHub Flavored Markdown

Unleash communication potential with GitHub’s vast support of simple and effective plain-text document formatting known as Markdown.


Details

A plaintext format for writing prose and documentation. In addition to the basic formatting options, Markdown files hosted and viewed on GitHub can make use of the following enhancements:


Interacting with shortcuts


GitHub, though it is a web application, aims to behave as much like a desktop app as possible. Many of its features are accessible via keyboard shortcuts. While on any GitHub page, press ? and a context-sensitive help menu will appear. Some of the most frequently used keyboard shortcuts include:


Additional resources


Details

This course covers many introductory and day-to-day uses of Git and GitHub. There are many more resources available to continue your exploration with the technology and platform, and we’ve included these here for you to explore.

Table of Contents