Introduction

Here I will discuss one major version control tool in this article. version control tool is one of the most needed software during application development. 

Why we need the version control tool

The version control tool is used to track the changes in the code. Using this tool we can maintain the comparison of the latest code with the previous version of code. Easily we can merge the code. Using this tool we can easily do remote development. 
There are several version control tools available, here I will only discuss the GIT.

Benefits of GIT

  • It is free of cost and open source.
  • In the repository, we can store the code private as well as public mode.
  • Distributed repository model.
  • Capable to handle small to large-sized projects.
  • Code changes can be tracked very easily and clearly.

GIt environment setup

Here I will set up for windows operating system. For knowing more about the setup go through the below steps.
  1. Download and install Git from GIT for windows
  2. Go to Git HUB web application and sign up.
  3. After installing the Git, you will find 3 icons like Git Bash, Git CMD, Git GUI. 
  4. For the initial Git setting, open the Git Bash and now you will get a screen like below
Git for beginners | Git setup for first time

       
       5.  Then write the below command on the Git Bash CMD
$git config user.name "Your Name"
$git config user.email "youremail@yourdomain.com"
In the name, input your user name and in the email input the email. 
GIT Credential setup

Now Git application successfully configured to our local machine.

Git repository creation, file push to the repository and pull from the repository 

  • Go to the  Git HUB web application.
  • Login there.
  • For creating a repository click on new 

  • Provide a repository name here, then choose as per your requirement, if you want to visible the code to all then in that scenario you can choose public else private. Here I have provided "MyDemo" as the repository name

  • Then click on the "Create repository" button, Now your repository created successfully.
  • Then click on your profile symbol dropdown(right top corner), Go to "your repositories" option, then click on that. Now you will find your newly created repository. 
  • Now you will get the list of the repository, click on the newly created repository and copy the link and save it on a notepad.
  • Go to your folder explorer and create a folder. Keep a file there. 
  • Here My folder name is Bidya_Demo. I have kept a file named as "Test Test"
  • Through the command prompt go to the newly created folder location.
  • For initializing the local folder as a Git repository write the below syntax in command prompt.
git init
  • Here, I will add a repository, write the copied repository on the command prompt using the "git remote add origin" syntax like the below.
git remote add origin https://github.com/BidyaMishra/MyDemo.git
  • Check the status of the local origin using the below syntax.
git status
  • Add the untracked files, using the below syntax.
git add -A
  • Push the file to the repository using the below syntax.
git push origin master
GIT for beginners

Let's have a discussion about the above command prompt.
  • cd Bidya_Demo: Changed directory to the "Bidya_demo" folder.
  • git init: Initialized local folder as a git repository.
  • git remote add origin https://github.com/BidyaMishra/MyDemo.git: Added remote repository in the local folder.
  • git status: Status checked and found one file has not added.
  • git add -A: Added the "Test Test.txt" file.
  • git commit -m"Added new file": Committed the file and provided the comment
  • git push origin master: Pushed the file to the remote repository.
Now go to the Git HUB and you will find the "Test Test" file.

If you want to pull the files from Git HUB to any local folder, Then follow the steps.
  • Create a folder.
  • Initialize it.
  • Add remote origin to it.
  • Then make a pull request.
GIT For beginners


Here only one new thing I have added "git pull origin master". This is used to pull the file to the local origin.

SUMMARY

Here I discussed how to set up a Git environment in our local environment. Also, I discussed the basic details of Git for the beginners. I hope this article will help you. Happy to helping you 😊