Wilson Mar bio photo

Wilson Mar

Hello. Hire me!

Email me Calendar Skype call 310 320-7878

LinkedIn Twitter Gitter Google+ Youtube

Github Stackoverflow Pinterest

Git stores changes to use GitHub for backup and change management


Overview

This video shows how Git works with GitHub (or GitLab) to download files, and how Git’s clone and push makes GitHub a better backup than redundant copies of files.

Video

(The diagram above was created using Camtasia 3 on Mac based on screenshots in PowerPoint containing the narrative below.)

Narrative (captioning)

GitHub.com (and its equivalents) store repositories, or repos for short.

If we want a copy of a repo on our local machine, we have several choices.

If we don’t intend on changing anything, on GitHub we can click Download ZIP to download a file to our machine’s Downloads folder.

github-download-599x257-59kb

The name of the zip file downloaded has two parts: the repo’s name and the branch downloaded. This is because a zip file is designed to contain only one rather than multiple branches like Git.

After we unzip to a new folder, its files are accessible by a Mac Finder or Windows File Explorer as well as IDEs and custom apps.

Apps usually have their own default folder so they have a consistent place to look for assets. So many unzip directly into that default folder.

There is always risk of hardware or human failure, so we need to be able to fall back on older versions. Traditionally, duplicate copies of files and entire disks are created occasionally as backups, with zip files copied to an external location (usually with a date and time stamp in the file folder name). But these occasional copies usually don’t happen often enough, so there is still risk of loss.

And, external copies make it difficult to compare differences among different versions, even though IDEs have their own utility to compare files to find differences.

So most people think this a messy, error-prone approach.

The more popular alternative today is, instead of making duplicate copies, install a Git client program that stores the entire history of changes in its local .git folder containing objects that track every change in every file.

Git clients have a low-level mechanism to identify differences. So you don’t need to keep multiple full backups copies locally. The program recognizes various git commands that many IDEs also can issue.

So you don’t need to use Terminal commands all the time.

Instead of manual downloads and unzips, the client program clone repos from a remote GitHub.

Incremental changes are pushed back to the remote repository.

GitHub is, essentially, the ultimate external backup.

git-why-650x274-80kb

More

This is one of a series on Git and GitHub:

  1. Git and GitHub videos

  2. Why Git? (file-based backups vs Git clone)
  3. Git-client based workflows
  4. Git whoops (correct mistakes)
  5. Git rebase
  6. Git commits with a Tag and Signature
  7. Git HEAD (Commitish references)
  8. Git commands and statuses

  9. Git custom commands
  10. Git utilities
  11. Git hooks

  12. GitHub data security

  13. TFS vs GitHub
  14. GitHub REST API
  15. GitHub GraphQL API
  16. GitHub PowerShell API Programming
  17. GitHub GraphQL PowerShell Module