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:
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.
The six core concepts in the GitHub ecosystem are:
|cross-repo refs org||user/repo#num|
README.mdin any folder level
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.
Repositories can be created in numerous ways, including:
git initat the command line
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.
The GitHub web interface allows you to interact and perform many file-affecting actions directly through your browser:
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
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.
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.
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.
# Retrieve GitHub changes git pull origin [master|branch] # Publish local changes git push origin [master|branch]
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 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.
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:
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:
tfuzzy file search
sset focus to the search box
cgo to code
igo to issues
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.