top of page

What is git? How to merge two branches? How to pull request using git?

What is Git?

Developed by : Linus Torvald

GIT=Distributed Version Control System

SCM – Software configuration management/Source code Management


Why Git?

Ans: Git is use to manage your program so that u don’t have to manage it. Suppose in organization there are multiple machines and every code.

Is stored at server ,If server crash then everything we will lost and if we are creating copy of every project then it will be messy and to manage it difficult for us like we lots of people working in a team for 1 single project.

So to handle code of everyone is not possible with us efficiently because someone write something and someone write something else .


So Gits come into picture . And we can make copy of project locally its Local repository and remote repository that everything stored in server (github) so that nothing will lose .


Example of git why we should go for it?

Like we are building project for a client and if we build something according to his requirement and some day later he say I want more requirement and we add more in that project and after some days he said I don't want this things is cut it form project then we cut it from the main project if we don’t create of a copy of this project then what happen if clients request that yes it was fine I want back that things it no my project but I deleted that code from my project so I have to write again but GIT will do such functionality that we can add new things into project and project when updated its update into new project and keep master project as well. So that everything manage for programmer.

Trunk based Development



For local repository

Gitlab,Atlassian

For Remote Repository

Github

BitBucket

GUI tool to work with them

Sourcetree


How to create github Account go to web browser and search for github

Or click on this link

https://github.com/ fill the form and sign into you account.

When you loggined into your account you can see the new Repository


Create new one I was created cooks for demo:

Choose public if u choose private then you have 2 pay for it. And check box README and now click on create Repository.


Now click on Create new file name it as recipe.txt



And I write into this file Welcome ...


Click on commit



Here you can see recipie.txt file is there now if u want to add some more things to it click on file .


Edit the file and you can write more.


Now commit again.



And now click on commits where (3 commits) now you will see the list .


Here u can see 3 list initial commit is when we create a repository 2 will

Your when u create 1 st time file recipie.txt and write something and when I write I give you food updated file.

Now click on these you will see ad picture will be clear that it doesn’t change from the 1st file and created new one and with the help of previous 1 and updated the file. You can view file



How to change branch or means If some one add into project he is following different path or we can say doing something else related to that project and main project will be as it is nothing change made into that project.


Open you recipie .txt file and change something and change branch like.

Before commit choose new branch checkbox and give your branch name like I was given kitchen.


Now go back to your reposit.and click on code you can see the branches here.


When you choose branch kitchen and view file recipie.txt then you can see what I updated last its visible here.


When you choose master then you can see the old data .



How to merge two branches ?

You just click on cooks and here you can see option for compare and pull request.


Click on compare and pull request


Now click create pull request and click on merge pull request.


Click on confirm merge

Now again click on cooks repo and you can see change go back to master and click on recipe.txt and you can see the main file is updated .


If you like Codersarts blog and looking for Programming Assignment Help Service,Database Development Service,Web development service,Mobile App Development, Project help, Hire Software Developer,Programming tutors help and suggestion  you can send mail at contact@codersarts.com.

Please write your suggestion in comment section below if you find anything incorrect in this blog post.


bottom of page