/Frontend/Basics/
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. This is especially useful for collaborative projects and showing your projects off to the public (like employers π) PLUS you won't lose your work as all your code, public or private, will be stored in the cloud! I originally used to store all of my code on a single microSD card until it snapped accidentally and all of my past progress was gone (including an AI to predict Crypto price changes) so version control is pretty important to know and actively use.
Why use version controlβ
- Collaboration: Version control allows multiple people to work on the same project across many files without overwriting each other's changes.
- History: Version control keeps a history of all changes made to a file, so you can see what has changed and when so no data is lost.
- Rollback: If you make a mistake like deleting your entire project, you can easily roll back to a previous version of a file.
- Branching: Version control allows you to create branches of your code, so you can experiment with different changes without affecting the main (official) branch.
so you should really use version control. Even the creator of linux himself is an avid version control user AND Epic Games
Git vs. GitHub π€ π€
Git is a popular version control system that is used by many developers and can be managed via a command line or user interface (like in VSCode) to update your versions. GitHub is a web-based platform with a user interface that allows you to store and manage your Git repositories, it can also be used as like a social media for developers π.
What is Git? Explained in 2 Minutes! - Programming with Mosh π²
- 2 minute vid on what version control is & git if you want more details (it's pretty informative for 2 minutes)
- Also the thumbnail says it's an hour but don't worry it isn't
Content
Install Git π¨
So to actually use git, you'll need to install it to your system which if you don't already have it, below is a video you can follow to install git.
- There's also more lessons in this playlist the video is from which're good if you still don't understand git after fireships vid below
Now, to check and make sure git's installed and visible by VSCode, open VSCode and make sure it doesn't say something about you not having git. You can see that in the version control panel of VSCode which is found here (Circled in white) and that's also what it should look like when git's installed
How to use Git and Github - Fireship π₯
- Only 1 video is necessary to get a grasp of version control with git before you start using it
Challenge ββ
Add some git to your life
Think back to the mini projects you made across the last 3 guides in our languages
section. Focussing on the Javascript portfolio you made, add some version control by setting up git and publishing your code to github so you'll be able to view your it from anywhere and edit it on any device of yours.
- This challenge is important as it's necessary for the next section on deploying your websites to the internet
Here're some steps to guide you:
- Setup a github account if you don't already have one
- Create a new repository (Don't tell it to include a
README
) - Navigate to where you stored your portfolio websites files on your computer in VSCode
- Think back to the fireship video and how he used the command line (Or VSCode GUI but command line is preferred) in his projects directory to version control his files
- Setup version control in your project and push your code to github
- Check Github to confirm you did all of this correctly and all your files are there
- Celebrate π₯³π
- If you get stuck after making your repository, github actually shows you how to add an existing project with your code from your computer to github with commands in your command line (It looks something like this)
Click me once you've completed!!
Recap π
Version control is a powerful tool that can help you to manage your code and collaborate with others. Git is a popular version control system that is used by many developers. GitHub is a web-based platform that allows you to store and manage your Git repositories.
Now that you have learned the basics of version control, you can start using it to improve your workflow, and NOT accidentally lose all your work (Like I have before π’)
Here's a nice fireship vid which you should now hopefully understand