Version Control
Git
Git is the most commonly used version control system. Git tracks the changes you make to files, so you have a record of what has been done, and you can revert to specific xversions should you ever need to. Git also makes collaboration easier, allowing changes by multiple people to all be merged into one source.
Github
GitHub is a code hosting platform for version control and collaboration. It lets you and others work together on projects from anywhere.
How to Start a repository on Git and Github
There are many tools that one can use to operate git, but I personally prefer git bash
as when using git I tend to run into alot of errors(wrong branch, couldnt connect to upstream etc.)
and some git tools such as github desktop are unable to show these errors and it would take longer
to debug these issues.
|
Steps
- Firstly go to github and create a new account and install git bash
- Create a repository and copy the url link of the repository
-
Open Git bash and change directory to your local project by using the code
$ cd C:\Users\... -
Initialise the local directory as a Git Repo
$ git init -
Add the files in the new local repository. This stages them for the first commit
$ git add .
Take note that the . stands for everything. So in this case, this command means that git will stage all the changes, you can add individual files as well -
Commit the files that you have staged in your local repository
$ git commit -m "any message that you want"
The -m in this line of code stands for message and in the open and close quotations, just type any message or reminder to label this commit, it could be "first commit" or "finished html file but css is not done". Be sure to type something meaningful in case in the future you want to revert back your code! -
Now we can paste the url you copied in front to tell git where you want to push your files to
$ git remote add origin remote repository URL
Github may ask you to sign in at this point, just follow along and you should be fine! -
Finally just Push your files and Github should be able to recieve them!
$ git push origin main