What is Version Control System(VCS): 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, which can also be said to be a tool that helps record changes to files by keeping a track of modifications done to the code. one of the widely use VSC among software developers or engineers is called git.
If you’ve never used Git, you may be nervous about it. There’s nothing to worry about, just follow along with this git-starter-pack-for-beginner, and you will soon have a new Git repository hosted on GitHub.
Before going further let’s clear the air of misconception that comes to mind when we hear the word Git and Github. Git is the Version Control System that helps in keeping track of our code like all modifications and changes made, while Github on the other end serves as a host for git, I hope this short note helps someone out there to clear the misconception.
Step 1: Install Git on Your Machine.
To be able to use git command on your computer. visit https://git-scm.com/downloads and download the version of git that is suitable for your computer, in my case am using a windows system.
To check if git has been installed on your machine do that below:
To have definitely make a huge step turning yourself into a guru using version control.
Step 2: Open an account on GitHub.
The easiest way to get started is to create an account on GitHub.com (it’s free).
One of the tips in here is using a unique username and a more flexible password you can easily remember.
Step 3: Create a new repository
What is a repository: A repository (slogan among devs repo) can be referred to as a container that is been used to store one’s code. To create it, the image shown below would be displayed for you when you are about to create yours, so click on New repository on the dropdown.
After the new repository has been clicked, we were taken to the page below so as to create our repo.
Enter a name for your repository (e.g, “MyFirstapp”) Repository. Set the repo to public if you want it to be seen by all your viewer, while if you set it to private would be seen only by those you gave access to and click Create.
Take note of some of the commands in the picture above this text.
Step 3: Create a Folder to put your project.
Create a folder in the directory of your choice, after doing that click on the folder you just created and press shift key + Right Click on it to have what is below.
So in my case, my default terminal is Powershell which might differ on yours, but the idea is we want to open our project in the terminal with the correct directory. so I am going to click on the open PowerShell window here.
Step 4: Create a file
Say a Kudoz to yourself, you have successfully created a folder to set up your project, so at this point go back to your GitHub to follow through all the command.
Getting started to place the control of your project in git's hands. You have to initialize your project using the command in the below image.
Yo! you now have placed your project in Git's hand to handle, go further to add up the file you want to commit into git’s hand
the next in line is to commit the changes you made to your file using the below command.
Commit can be thought of as a milestone. Every time you accomplish some work, you can write a Git commit to store that version of your file, so you can go back later and see what it looked like at that point in time. Whenever you make a change to your file, you create a new version of that file, different from the previous one.
Step 5: Connection Your Local File to the One on Github.
Now you are ready to connect your code to the host (GitHub), using the command below.
Now you have created a connection between your local file and the one online.
Step 6: Push Your Local file to the host (GitHub).
Using the command below you would be able to push your file to the host.
git push -u origin master
To be sure you have successfully pushed your file go to GitHub to check.
Congrat FAM you have successfully created your first repo.
You as well check this out to go a step higher using git…..
I hope you found these pieces helpful.