Home Software Github Colabs Shell Basics Apis Webscraping Nbdev Javascript Packages Cloud Functions Browser Extensions Path Css Css Animations Fonts Unicode Ascii Javascript Llm Paradigms Protocols Shortcuts Webrtc Websites Windows

Don't Look! I'm changing!

URL Copied

The contents of this page are as follows in Scott Chacon and Ben Straub's book Pro Git. The book was published by Apress under the Creative Commons Attribution Non Commercial Share Alike 3.0 license. Online and Ebook versions of the book are also available.

BinderBinderBinderOpen Source Love svg3

NPM LicenseActiveGitHub last commit

GitHub starsGitHub watchersGitHub forksGitHub followers

TweetTwitter Follow

What's Covered?

Version Control

GitHub

Not Covered but Noteworthy:

  • Versioning

  • Commiting from Colab

  • How to create a repo from an existing project

  • Browser Extensions

  • Github's special 'profile' repository

  • Github Projects - Dev/mgmt tools and Collaborative Kanbanboards all wired up to respond to git commits.

  • Github Teams - A chatroom for people working on a repository

  • Github Organizations - Can house multiple repositories and provides admin tools to manage people across teams and projects.

  • Github NPM - Publish Javascript libraries to NPM using Github

  • Github Actions

Version Control

What is it?

Version control is a system that records changes to a file or set of files over time so that you can recall specific versions later. - Chacon and Straub, Pro Git

Why do we need it?

Many people's version-control method of choice is to copy files into another directory such as time-stamped directory if they are clever. This approach is common because it is so simple. However, it is also incredibly error-prone because it is easy to forget which directory you are in. Consequently, you could accidentally write to the wrong file or copy over files you do not mean to. The next major issue that people encounter is that they need to collaborate with developers on other systems. - Chacon and Straub, Pro Git

How is it done?

This is where Distributed Version Control Systems (DVCSs) such as Git, Mercurial, Bazaar, and Darcs step in. In a DVCS, clients do more than check out the latest snapshot of files. They fully mirror the repository including its full history. If any server dies and these systems were collaborating via that server, any of the client repositories can be copied back up to the server to restore it. Every clone is really a full backup of all the data. - Chacon and Straub, Pro Git

Git

Git is an open-source tool used by developers to establish version control in their projects using commands executed from the terminal.

Github is a website/application that allows you to upload your git repository to the web for distributed collaboration, control, and storage. (Move of this wil be covered in the next section).

Since its birth in 2005, Git has evolved and matured to be easy to use while retaining the initial qualities. It's amazingly fast, it's very efficient with large projects, and it has an incredible branching system for non-linear development. - Chacon and Straub, Pro Git

See Git Branching for more details.

  1. Nearly every operation is local.

Most operations in Git need only local files and resources to operate. Information from another computer on your network is generally not needed. - Chacon and Straub, Pro Git

  1. Git has integrity

Everything in Git is checksummed before being stored and is then referred to by that checksum. It is impossible to change the contents of any file or directory without Git knowing about it beforehand. This functionality is built into Git at the lowest levels and is integral to its philosophy. You can’t lose information in transit or get file corruption without Git being able to detect it. - Chacon and Straub, Pro Git

  1. Git generally only adds data

When you do actions in Git, nearly all of them only add data to the Git database. It is hard to get the system to do anything that cannot be undone or make it erase data in any way. As with any VCS, you can lose or mess up changes you have not committed yet. But after you commit a snapshot into Git, it is difficult to lose, especially if you regularly push your database to another repository. - Chacon and Straub, Pro Git

While there are many ways to use Git, the general approach follows these three stages.

Git Stages

Using Git can be accomplished through a variety of methods, including:

GitHub

Whereas Git is used stand-alone for version control purposes, it is in tandem with GitHub (or Bitbucket). As a free survice, GitHub enriches existing features and adds further utility. To truly understand what this means, let's try it out for ourselves!

1: Create a GitHub account

1A) Create a new GitHub account.

1B) The top right corner provide shortcuts to some of GitHub's best features.

The following shown below is the accounts dropdown.

Click on the 'Your Profile' tab to go to a dashboard comprising all of your past works (if any).

Your username will be the URL's basepath for all future projects.

This basepath also serves as the link to your profile page.

If you are feeling brave, click on different tabs in this dropdown to see how they relate to your profile page and basepath!

For example, the link to my profile page is as follows:

If you click on the 'Your Repositories' dropdown option:

  • The url changes to github.com/bnia?tab=repositories**

  • The navigational tab on the topmost of my homepage will change from 'Overview' to 'Repositories'.


2: Create a project repository

2A) Navigate to the '+' menu button and click "New Repository".

Below are features available in this portion of the site:

2B) Complete the form that appears with your information.

  • Be sure to click "Initialize this repository with a README".

  • A sample is provided below.

More information on setup and configuration can be found here.

3: Editing a file in the repository.

3A) At this point, you should be looking at something like this:

  • Green (top right) - Quick links

  • Mint/Pistachio (top left) - Basepath / ProjectName

  • Purple (second most top right)

    • Watch a project to track its progress with using alerts.

    • Click the star to favorite a project.

    • Fork a project to create an identical copy.

  • Red (third most top right)

    • Delete or rename a project here.

    • If youre code contains Markup, HTML, or JS it can be hosted for free using GitHub pages.

  • Light Blue (center screen) - See when the project was last edited here.

  • Gray (center screen)

    • This is the file directory.

    • All files will be shown here.

    • Click a link to change the page and view its contents.

    • Clicking a file from the file directory will show the content of the file much like is demonstrated in the yellow and orange section in the picture

  • Yellow (bottom)

    • If the project has a README.MD file, the content of that file file will be parsed, rendered, and shown here.

  • Orange (bottom above the yellow)

    • The filename is shown in the left orange circle.

    • commit edits to the README doc using the right circle pencil icon.

The contents of a README.md file should be shown towards the bottom half of your screen.

3B) You are now looking at the contents of the "README" file.

  • You can edit the document using HTML, Markdown or plaintext.

  • To commit your edits, scroll to the bottom of the page and select Edit.

To learn more about Markdown and other cool GitHub features, check out these guides.