What and Why Github?

If you are beginner , you might have heard the term Git and Github . I remember when I was a beginner , I too had difficulty in understanding what actually is git . So today, I will tell you what is git through my understanding. Let's get started.

Git can be considered as a book where you can keep a record of all the changes that you do in a code . You can push these codes online for others to see . GitHub is a code hosting platform for collaboration and version control. . This means you can share your code with others , also can collaborate with other people on the same database . Basically , different people can work and change a code on the same database .

Git is used to share code. For that it helps to have a central place where different people can reach the code . There are various platforms that allow us to put our code online such as Github , Gitlab , Bitbucket . But Github is the most popular one .Github is an open source platform .This means that anyone can see and use your code. They may even help you with your project. You can make your repositories as public and private .

There are 4 main essentials that you need to know before you start with github:

1. Repository

It is used to store the development project . It can contain various files , folders , images and much more .

2. Branch

A GitHub branch is used to work with different versions of a repository at the same time. Yes , a project can have different versions at the same time .By default a repository has a master branch. New Branches are for bug fixes and feature work separate from the master branch. When changes are ready, they can be merged into the master branch.

3. Commits

The "commit" command is used to save your changes to the local repository. Each commit has a description explaining why a change was made.

4. Pull Requests

Pull Requests are the heart of collaboration on GitHub. When you open a pull request, you're proposing your changes and requesting that someone review and pull in your contribution and merge them into their branch. Pull requests show diffs, or differences, of the content from both branches.

I hope you are clear with basics and have an understanding of Git .

To use github in your pc , you need to install the git on your computer . Once it is intallled , you can initialise a git through "git init" commnad in the project directory .

After initialising , type "git add ." . This will add the files that are changed in the git .

Next command is to commit the updation in the file . This will make new version of your files. "git commit -m "message" " . Here "-m " is used to add the message to the committed folder .

If you want this git to be uploaded online , you can create an account of gitlab or any other git controllers . After creating the account , create a git repository . Add the origin of the git repository , type in the command

git remote add origin "yoururl"

Once the origin is added , pass in the command "git push -u origin master". Here you can have different branch other than master . Ihope now you have a clear understanding about git . Its a good practice to have versions of your code .