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.
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.
About Git People
https://www.openhub.net/p/git
https://www.openhub.net/accounts/gitster Gitster Junio C Hamano in San Jose. programs in C.
https://www.openhub.net/accounts/Linus-Torvalds
More
This is one of a series on Git and GitHub:
- Why Git? (file-based backups vs Git clone)
- Git basics (script)
- Git whoops (correct mistakes)
- Git command shortcuts
- Git interactive merge (imerge)
- Git patch
- Git utilities
- Git hooks
- GitHub data security
- GitHub actions for automation JavaScript
- GitHub REST API
- GitHub GraphQL API
- GitHub PowerShell API Programming
- GitHub GraphQL PowerShell Module