In this lesson, you'll learn the basics of version control with Git and GitHub. But why do you even need version control?
You might remember writing a long, heartfelt email or an important job application or even just filling out some input fields on a website. Right when you're happy with how your text was coming along, and you were nearly finished... Suddenly your computer crashes, the internet connection drops, or you notice that the page has become unresponsive. All your work is gone, and there's nothing you can do about it anymore :/
You don't want the same thing to happen to the code you wrote. Using version control can prevent it from happening.
Info: Through using version control you can back up your code and keep it safe.
What Can Version Control Do
But version control does more than just save your code from getting lost. Using version control gives you the freedom to explore and try out things. You don't only back up against hardware and software failure but also against breaking changes that you, or a collaborator, might add to your code. Every time you commit your code, your version control system saves a current snapshot of your project.
Key Advantages
Committing your code to version control, therefore, allows you to:
- Time-Travel: Go back to earlier versions of your project
- Explore: Go wild experimenting, then discard what you tried if it ended up breaking everything
- Read History: Go back in time to understand how a project was built step-by-step
You could say that version control allows you to keep control of different versions of a project :)
Common Practice
Using a version control system for code projects is common practice for software developers. You'll need to be able to work with one if you are planning to make programming your profession. However, even if you are only doing this as a hobby, there are lots of advantages to keeping your code under version control.
Info: Keep in mind that this course wants to introduce you to important workflows and concepts in software development, not just the Python programming language. Version control is one of these important topics.
Using version control is not necessary in order to write code, and you've already written some quite elaborate scripts without putting them under version control. However, version control is necessary to write code professionally in order to collaborate productively with other programmers.
In the next lessons, you'll learn how to put your labs under version control using Git and GitHub. Give it a try, but don't despair if you don't get it to work right now. You can always skip these pages and come back to them at a later time.
Additional Resources
- CodingNomads: Version Control with Git and GitHub course
- Git SCM Book: About Version Control
- Wikipedia: Version Control
Summary: Introduction to Version Control
- Version control is not strictly necessary to write code
- Version control is common practice and is necessary to write code professionally and collaboratively
Key Advantages
- Time-Travel: Go back to earlier versions of your project
- Explore: Go wild experimenting, then discard what you tried if it ended up breaking everything
- Read History: Go back in time to understand how a project was built step-by-step