What Is Github and How to Use It
If you are someone who doesn't know how to apply GitHub, so this web log is for you. Github is a web-based platform used for version control. Git simplifies the process of working with other people and makes it easy to interact on projects. Team members tin can work on files and easily merge their changes in with the main branch of the project. Git & GitHub skill has slowly made its way from preferred skills to must have skills in multiple job roles.In this blog, I will accept you lot through the various functions and capabilities of GitHub.
In this "how to apply Github" blog, you will learn:
-
-
- Introduction to Github
- Create Repository in Github
- Create Branches and perform Operations
- Cloning and Forking Github Repository
-
Stride 1: What is Github?
To be very crisp about what exactly is GitHub, information technology is a file or code-sharing service to collaborate with unlike people.
GitHub is a highly used software that is typically used for version control. Information technology is helpful when more than but ane person is working on a project. Say for example, a software developer team wants to build a website and everyone has to update their codes simultaneously while working on the project. In this example, Github helps them to build a centralized repository where everyone can upload, edit, and manage the lawmaking files.
Why is Github then popular?
GitHub has diverse advantages but many people often have a doubt as to why not use dropbox or whatsoever cloud based system? Let me take the aforementioned example forrad to answer this question. Say more than than two software developers are working on the aforementioned file and they desire to update it simultaneously. Unfortunately, the person who save the file first volition go precedence over the others. While in Github, this is non the case. Github certificate the changes and reflect them in an organized manner to avoid whatever chaos between any of the files uploaded.
Therefore using GitHub centralized repository, it avoids all the confusion and working on the same code becomes very easy.
If you look at the image on the left, GitHub is a fundamental repository and Git is a tool which allows you to create a local repository. Now people usually get dislocated betwixt git and GitHub just its actually very unlike. Git is a version control tool that volition allow you to perform all kinds of operations to fetch data from the fundamental server or push button data to information technology whereas GitHub is a cadre hosting platform for version control collaboration. GitHub is a company that allows you to host a central repository in a remote server.
Now permit me list down the ways in which GitHub makes git simple:
-
- GitHub provides you a beautiful visual interface which helps you to rails or manage your version controlled projects locally.
- Once you register on GitHub, y'all can connect with social network and build a potent contour.
So allow's get started with GitHub.
Step 2: How to create a GitHub Repository?
A repository is a storage space where your project lives. It can be local to a folder on your estimator, or it can be a storage space on GitHub or another online host. You can keep code files, text files, images or whatever kind of a file in a repository. You need a GitHub repository when yous have done some changes and are ready to be uploaded. This GitHub repository acts equally your remote repository. So let me make your task easy, but follow these elementary steps to create a GitHub repository:
- Go to the link:https://github.com/ . Fill up the sign up form and click on "Sign up for Github".
- Click on "Start a new projection".
Refer to the below screenshot to become a better understanding.
- Enter any repository name and click on "Create Repository". Y'all tin as well give a description to your repository (optional).
Now, if y'all noticed by default a GitHub repository is public which means that anyone tin view the contents of this repository whereas in a private repository, yous tin choose who tin can view the content. Likewise, private repository is a paid version. Besides, if you refer the above screenshot, initialize the repository with a README file. This file contains the clarification of the file and once you check this box, this will be the first file inside your repository.
Congratulations, your repository is successfully created! Information technology will look like the beneath screenshot:
So now my central repository has been sucessfully created! Once this is washed, you are ready to commit, pull, push and perform all the other operations. Now let'south movement forward and understand branching in GitHub.
Step 3: Create Branches and Perform Operations
Branching: Branches help you to piece of work on dissimilar versions of a repository at once. Let's say you want to add together a new characteristic (which is in the evolution phase), and you lot are agape at the aforementioned time whether to make changes to your main project or not. This is where git branching comes to rescue. Branches permit you lot to movement back and forth betwixt the different states/versions of a project. In the to a higher place scenario, y'all can create a new branch and examination the new characteristic without affecting the main branch. Once you are done with it, y'all can merge the changes from new co-operative to the primary co-operative. Here the chief branch is the principal branch, which is there in your repository by default. Refer to the below image for better understanding:
As depicted in the in a higher place epitome, there is a chief/ production branch which has a new branch for testing. Under this branch, two set of changes are done and one time it completed, it is merged back to the chief branch. So this is how branching works!
Permit's move ahead in ' how to utilize GitHub' blog, and learn how you can create a branch.
To create a branch in GitHub, follow the below steps:
- Click on the dropdown "Branch: master"
- Equally shortly equally you lot click on the branch, you can find an existing branch or you can create a new one. In my instance, I am creating a new branch with a proper noun "readme- changes". Refer to the beneath screenshot for better understanding.
Once you lot have created a new branch, you have two branches in your repository at present i.east. read-me (master branch) and readme- changes. The new branch is but the copy of master branch. And so let's perform some changes in our new co-operative and arrive await dissimilar from the chief branch.
How to use GitHub: Operations
Commit Command:
This operation helps you lot to save the changes in your file. When you commit a file, you should always provide the message, just to keep in the mind the changes done by you. Though this message is not compulsory merely it is always recommended so that it tin differentiate the various versions or commits you have done so far to your repository. These commit letters maintain the history of changes which in turn help other contributors to sympathize the file amend. Now let's make our first commit, follow the below steps:
- Click on "readme- changes" file which we accept just created.
- Click on the "edit" or a pencil icon in the righmost corner of the file.
- Once yous click on that, an editor will open up where you tin type in the changes or anything.
- Write a commit message which identifies your changes.
- Click commit changes in the end.
Refer to the below screenshot for better agreement:
We have successfully made our first commit. Now this "readme- changes" file is different from the primary branch. Side by side, let us meet how can we open a pull request.
How to use GitHub | What is GitHub | Git and GitHub Tutorial | DevOps Training | Edureka
This Edureka "How to employ GitHub" will give you lot a easily-on sit-in on how to access GitHub and piece of work on its various operations.
Pull Command
Pull command is the nigh important command in GitHub. It tell the changes done in the file and request other contributors to view information technology likewise as merge it with the main co-operative. Once the commit is washed, anyone can pull the file and can outset a give-and-take over information technology. Once its all done, you can merge the file. Pull command compares the changes which are done in the file and if there are any conflicts, you tin manually resolve it. Now let us see dissimilar steps involved to pull request in GitHub.
- Click the 'Pull requests' tab.
- Click 'New pull request'.
- Once you click on pull asking, select the branch and click 'readme- changes' file to view changes between the ii files present in our repository.
- Click "Create pull request".
- Enter any title, clarification to your changes and click on "Create pull asking". Refer to the beneath screenshots.
Adjacent, let us move forward and meet how tin can you merge your pull asking.
Merge Control
Hither comes the last control which merge the changes into the chief master co-operative. We saw the changes in pink and greenish colour, now let's merge the "readme- changes" file with the chief branch/ read-me. Go through the below steps to merge pull asking.
- Click on "Merge pull request" to merge the changes into primary branch.
- Click "Ostend merge".
- You lot can delete the branch once all the changes have been incorporated and if in that location are no conflicts. Refer to the below screenshots.
I hope you guys are trying these steps simultaneously while you are learning how to use GitHub. Next, let us move to our concluding topic in 'how to use GitHub' blog, i.e. Cloning and forking a GitHub repository.
Step 4: Cloning and Forking GitHub Repository
Cloning: Before I really talk about cloning a GitHub repository, first permit united states of america empathise why do we need to clone a repository. The answer is uncomplicated! Suppose you desire to utilize some lawmaking which is present in a public repository, you tin can direct copy the contents by cloning or downloading. Refer to the below screenshot for a amend understanding.
Cloning is actually unproblematic! In case you are facing whatever challenges on how to employ GitHub, please comment your bug in the section below. Moving forward, permit'south see what forking is.
Forking: Start, let the states talk nigh why practice we need forking. Suppose, y'all demand some code which is present in a public repository, under your repository and GitHub account. For this, we need to fork a repository.
Before we go started with forking, there are some important points which you lot should always keep in heed.
- Changes done to the original repository will be reflected back to the forked repository.
- If you make a change in forked repository, it will not b reflected to the original repository until and unless yous have made a pull asking.
At present let's see how can y'all want to fork a repository. For that, follow the beneath steps:
- Go to Explore and search for public repositories.
- Click "fork". Notation that this "tangent" repository is already forked 27 times and it is under "google"account. Refer the beneath epitome for better agreement.
Every bit before long equally yous click on "Fork", it will have some time to fork the repository. In one case washed you will notice that the repository proper name is nether your business relationship. For reference, you can have a await at the below screenshot.
Congratulations! You have successfully forked an existing repository under your own account.
That's all for this post, I hope you enjoyed it and got the solution for "how to employ GitHub".
If yous found this "How to use GitHub " blog, relevant, cheque out the DevOps training by Edureka, a trusted online learning company with a network of more 250,000 satisfied learners spread across the world. The Edureka DevOps Certification Preparation form helps learners gain expertise in diverse DevOps processes and tools such as Puppet, Jenkins, Nagios and GIT for automating multiple steps in SDLC.
Source: https://www.edureka.co/blog/how-to-use-github/
0 Response to "What Is Github and How to Use It"
Post a Comment