GitHub is "just" Dropbox for Git
Right now, I'm finishing my third session as a "Community Teaching Assistant" for The Data Scientist's Toolbox, the first course in Coursera's Data Science Specialization. The most challenging material in the course is learning the basics of Git and GitHub, and most of the 30,000+ students that have actively participated are brand new to Git. Since there are perhaps 1,000 posts in the discussion forums about Git each session, it's fair to say that I have a good sense of what beginners find confusing about Git.
Certainly, beginners get tripped up by the commands and the workflow, and many are also new to the command line. But the underlying issue is that they simply don't understand what Git does, how it works, and how it relates to GitHub.
That's why I was so excited to read this forum post from a student named Trent Baur, who was responding to another student's question (emphasis mine):
For the moment, forget about GitHub. Git is a completely local source control system and does not require GitHub.
Your repository is fully contained within your project's local directory and EVERYTHING is managed by a folder called ".git." (It may be hidden depending on your system settings.)
- When you make changes to your project and commit, the changes are stored in the ".git" folder
- When you rollback changes, the files in your project folder are changed and the changes are driven by your ".git" folder
- When you switch to a new branch or create a new branch (or 20!), they're all stored in and retrieved from the ".git" folder
Understanding this was an a-ha moment for me. It's all local and it's all THERE. You never need to DO anything inside the ".git" folder. But just know that the secret sauce is located there and only there. Every call within Git Bash causes an interaction with that folder and your local files and that's how version control is maintained.
GitHub is just Dropbox for Git. You're backing up your repository online with the added ability to share with other people. That's it.
BRILLIANT. This is the most clear and concise explanation I have ever read about Git and GitHub. I have tried to improve upon it, but can't.
To be clear, this metaphor does not tell the whole story about Git or GitHub, and ignores complexity for the sake of simplicity. Git is considerably more powerful and flexible than Dropbox, and (unlike Dropbox) is completely manual rather than automatic. In addition, GitHub's social features have helped to establish it as a platform for massive developer collaboration, which is a far cry from the use case for Dropbox. However, I do believe this explanation captures the "essense" of Git and its relationship with GitHub in a way that is accessible to new users.
In fact, last week I taught Git and GitHub to General Assembly's Data Science class in Washington, DC, and I found the Dropbox metaphor to be incredibly useful:
- "pushing" is like syncing your local file changes with Dropbox
- "pulling" is like updating your local files from Dropbox
- "cloning" is like copying your Dropbox files to a new machine
- "setting up a remote" is like configuring your connection to Dropbox
- "sharing GitHub repos" is like sharing folders in Dropbox
- "reverting changes" is like restoring an old version of a file from Dropbox
If you know someone who is struggling to understand Git and GitHub, please share this post with them! I also have a 10-part video series introducing Git and GitHub that many beginners have found useful, and a Stack Overflow answer explaining Git and GitHub in more detail.
If you want to quickly scan through the video content without actually watching the videos, below is the slide deck I used when teaching this content to the Data Science class. (Note that the videos consist of on-screen demos rather than slides, and the videos don't cover branching, but otherwise the content is very similar.)
If you're reading this and are beyond the beginner stage with Git and GitHub, you might enjoy the GitHub Cheat Sheet, an excellent collection of "hidden" features of Git and GitHub. The Cheat Sheet was inspired by Zach Holman, whose entertaining talk "How GitHub Uses GitHub to Build GitHub" is worth a watch if you want to get a peek into their development process and understand the philosophy behind the GitHub product.
"GitHub is 'just' Dropbox for #Git": Useful analogy for beginners? What do you think? https://t.co/ZbzuZUdWJJ pic.twitter.com/0kGVZKFh4e— Kevin Markham (@justmarkham) April 23, 2016