Think about when you're working on a school project, like writing an essay, creating a presentation, or building a website. You probably save your work many times. Sometimes you might even make copies: "MyEssay_Draft1," "MyEssay_Final," "MyEssay_ReallyFinal."
This can get a bit messy, right? It's hard to remember what changes you made between "Draft1" and "Final," and it's easy to accidentally save over something important.
Version control is a special system that helps us manage changes to our digital projects over time, ensuring we are good stewards of our creative efforts. Instead of saving countless separate files, it keeps a detailed, organised history of every change you make.
Think of it like a meticulous scribe or an archivist, carefully recording everything, so you can:
Records every single modification you make to your project, no matter how small.
Document when each change was made and who made it, fostering accountability and clarity.
Allows you to instantly retrieve any previous version of your project exactly as it was at that point, much like revisiting a past lesson to guide future actions.
Enables multiple individuals to collaborate on the same project harmoniously, ensuring that everyone's contributions are preserved and integrated, reflecting the collaborative spirit of the community.
It provides a powerful "undo" capability for your entire project, combined with the ability to rewind and explore any stage of its development.
Git is a powerful version control system. It's the core "engine" that runs locally on your computer, diligently tracking and managing all these changes within your project files.
GitHub is a widely used web-based platform that complements Git. Think of GitHub as a secure cloud-based repository and a collaborative hub for your Git projects – much like a shared digital common ground where individuals bring their unique talents to contribute to a collective endeavour.
The first part of the video shows how to install Git on your device. The school computers already has Git installed.
The second part of the video shows how to clone a repository, stage changed, commit, and push to GitHub.
Malaitai. (2023, March 11). Installing Git and using GitHub [Video] YouTube.
Whether you are creating your own repository or you are accepting an assignment, you need to clone the repository onto your device. This is basically copying and pasting to your device.
Firstly, you will need to find somewhere to clone your repository on your device/local device. Whether that is your Desktop or a folder, make sure that the folder does not move around.
Copy the repository link by clicking on the clipboard
Open VS Code on your local device
Control + Shift + P
Type git clone
Press Enter
Paste (Control + V)
Press Enter
Use the folder from Step 1. as your Repository Location
Once it's cloned, click Open
If it asks if you trust this folder, click "Yes, I trust the authors"
One of the complicated things in the beginning of using Git is committing and pushing your repository. This helps you keep track of your project and enables you to go back to any commit you have done in the past.
When you have made modifications to your code, added files, removed files, or made any changes to your repository, you have made changes. These changes show the difference from your last committed version to your most recent version. You need to stage the changes and prepare them to commit them if you want it saved on GitHub.
Go to Visual Studio Code > Source Control
Click the file that has been either created, modified, or removed
Click on the + symbol to stage the change. This will put the file in the Staged Changes section
In the Message section, write a short and brief message/comment about what you have done
e.g., Added index.html file
Click on the tick to commit the changes
Repeat steps 3, 4 and 5 until all your files are committed
Once all the files you have changed have been committed, Control + Shift + P.
Type git push
Press Enter
All your files that you have committed on your local repository are now on your remote repository on GitHub