Git & Version control for babies | Part 01
What is version control?
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.
For example :
Imagine you’re working on a storybook. You start with a basic story, but as you keep writing, you change the characters, the plot, and even some of the artwork. You might want to go back to an earlier version of your story to see how it was before you made certain changes, or to compare different versions.
Without version control, you might end up saving multiple copies of your story, each with a slightly different name like “storybook_v1”, “storybook_final”, “storybook_final_final”, and so on. This can get confusing very quickly!
Version control helps by automatically keeping track of all the changes you make to your files. If you ever want to see what your story looked like last week, or if you made a mistake and want to undo some changes, you can easily go back to any previous version. It’s like having a magical undo button that works for everything you’ve done over time.
Git, a popular version control system, does this by creating snapshots of your files as you work on them. You can think of these snapshots as different versions of your storybook, saved at different points in time. This way, you always have a history of your work and can explore it whenever you need to.
Centralized Version Control Systems
The next major challenge developers faced was collaborating with others across different systems. To address this, Centralized Version Control Systems (CVCSs) were created.
In these systems, such as CVS, Subversion, and Perforce, a single server holds all the versioned files, while multiple clients check out files from this central repository. For many years, this approach became the standard in version control, streamlining collaboration by keeping all changes in one central location.
Centralized Version Control Systems (CVCS) are like a big library where everyone keeps their books. In this library, there’s one main bookshelf (the central repository) where all the important books (files) are stored. Whenever someone wants to read or make changes to a book, they go to this main bookshelf to get a copy.
In a CVCS, the central repository is the single source of truth. It holds the complete history of all files and tracks every change made by every user. When you want to work on a file, you check it out from the central repository, make your changes, and then check it back in. This process ensures that all changes are recorded in one place, making it easy to see who made what change and when.
Distributed Version Control Systems (DVCS)
Distributed Version Control Systems (DVCS) take a different approach compared to Centralized Version Control Systems (CVCS). In a DVCS, every user has a complete copy of the entire project history, not just the latest version of the files. This means that the repository is fully distributed among all the users, and there’s no single point of failure.
Imagine you’re playing with a group of friends, and you all have your own set of building blocks. Each of you is working on your own little castle, but you can still see what the others are building. If you like something your friend has made, you can copy it and add it to your castle, and they can do the same with yours. This is a lot like how Distributed Version Control Systems (DVCS) work!