Whether you are new to the coding world or you have been coding for a while, you must have heard the word “Github”. While some may know about it, there are those who aren’t really familiar with what it is and how it is used, but have come across it enough times to know it is extensively used. If you are one of those, you need not to look any further because here I am going to provide you a step by step guide on how to use Github along with the basic introduction so let’s take a quick look at the what all we are going to cover.
What is Github?
Github basically is a social networking platform for coders and programmers and is so widely used all around the world. In a simplest way possible it can be described as a platform where number of coders or programmers come together to work on projects, share code files, branch out their ideas, brainstorm and make changes in existing files as required.
Watch this video on DevOps Tutorial for Beginners
I bet if you have tried to look up what github is then you have had to stumble across some definitions using all these technical terminologies which instead of making things clear about github just add on to the pile of confusions.
So before we get started with the “how to use” part let’s get familiar with some basic terminologies associated with github.
Version control, which can also be termed as revision control or source control, is a process that helps in tracking and managing the changes made in code files over time.
Git is a free and open source tool to perform version control. It keeps the old versions of the code files as well even after the changes have been made.
Watch this GIT Tutorial for Beginners video
Now that we know what these terminologies mean, it will be easier to grasp the more technical way of describing github, that is, Github is a web based platform which provides hosting service for version control using Git.
Well now we have a basic understanding of github, but there still remains a question unanswered, that is, why is github so popular? And why are programmers so excited about it?
There has to be something that makes it special and different. More and more developers are using github more than any other file hosting service and while the choice eventually comes down to the personal preference but the reason that they are leaning more towards github is a subject of social dynamics. Let me explain what I mean by that.
Github has been supporting and using git from early days of when this technology came into the picture. Because of which it has been able to accomplish some tasks that the other hosting services could not provide. For example, if there is a project and some of its files have been edited and changed by more than one programmer or developers at the same time while they were working on it, if it were any other hosting service, it would just save the latest changes that were made. Whereas in github all the changes are documented and managed and this makes working in that case scenario much less prone to confusions.
By the time other file hosting services realized how beneficial is git and how it’s taking over the world, Github had already gained more popularity and familiarity among programmers which in turn built a strong community in github.
Use this GIT Cheat Sheet and boost up your knowledge for interviews.
Difference Between Git and Github
While learning about github you will come across the term “git” which is commonly confused with github itself by so many people that it has started its own discussions.
So in order to learn more about github it only makes sense that before we move any further with how to use github let’s first clear out any and all confusions between git and github.
So here I have listed some key differences between these two. Let’s take a quick look at these to understand both of these individually.
|Git is a tool to execute version control.
||Github is a platform that utilizes Git to carry out its functionalities.
|It is a software and in order to be used it has to be installed.
||It is web based hosting service so there is no hassle of installation.
|It is a command line tool.
||It provides a graphical user interface.
|Git provides features like management of edited files.
||It has some additional features of its own like task management along with the features that come with the benefit of using git.
After addressing how github is different from git,let’s get started with github and learn how to use github in detail. I will walk you through the steps one by one and by the end of this blog you will have learned all the essentials you need to know about github to get started with it.
Learn about more key differences between Git and GitHub in this comparison blog on Git vs GitHub.
Steps On How To Get Started With Github
Step 1: Creating and setting up an account on Github
It’s not really any different than creating an account on any other social media platform. Just go to the official github website or click here.
The link will take you to the page which will look like the following screenshot. Fill up the form and then click “sign up for Github”.
Step 2: Creating a repository
Once you have signed up and you are in, it will look something like this:
The next thing that you need to do is create a repository. Before I guide you with that, I know we did not mention anything about repository before but you need not to panic, we are not going to skip that. I will make that term familiar and clear to you before we learn how to create a repository. So, stay with me.
A Repository is like a storage container or folder for your project. It contains all the project files including all the documents, code files and other necessary project elements that are important to make, build and run your project.
Now coming back to “creating a repository”, all you have to do is click on the “new repository” and it will take you to a new page which will look like the following screenshot.
The only thing left for you to do to create the repository is fill up the fields.
As you can see in the screenshot, you have been provided with the option to choose who can see your repository. By default its set to public which means that by choosing to make the repository public you are making it available for anyone to view the contents of the repository unlike in private where you get to choose who gets to see the content and this feature is available in paid version.
Also if you want to download the repository to your local system then you can initialize the repository with a README.
After you have filled all the fields carefully, click on “create repository” and voila! You have successfully created and set up your first repository.
Master the DevOps tools by taking up DevOps Training and become a DevOps Expert!
Step 3: Performing some basic operations
Congratulations! You have made it this far!
Now moving further, let me introduce you to some operations to give you an idea of what all you can do with your repository.
Let’s go through the following list of some of the basic operations with their respective commands and learn what functionalities these operations provide.
- This operation is used when you want to create a copy of any code file in public repository
- Command: git clone/path/to/repository
- Add files:
- This operation as it is pretty clear from the name adds one or more files to your repository
- Command: git add <filename>
- When you want to edit or change something in your file and save those changes, the operation you need to use is called Commit.
- Command: git commit -m “Commit message”
- Push: Before we learn what and how is push operation used, we need to know what are branches and master branch in github. So let’s look into that.Sometimes while working on projects you will get different ideas, sometimes over time or sometimes simultaneously and you will want to try them out but without affecting the existing files.This is where the concept of Branching comes in handy.So Branches are basically created to provide you a safe place or an environment to play out those ideas without affecting the master branch which is the very first and repository’s default branch. Coming back to the push operation!
- Push operation when used sends the changes to the master branch of your repository.
- Command: git push origin master
Knowing and understanding all these basic operations is going to help you use github with confidence.
Want to learn about the commands in Git! Check out our blog on Git Commands.
Benefits Of Github:
Lets first take a look at the following benefits of Github:
- Github has made it easy and hassle free to showcase you projects and applications.
- Being a social networking platform for coders, you can browse and follow popular development projects and get to learn from them.
- It also allows you to make changes and contribute your ideas to your favourite open source projects available on Github.
- And of course there is the added benefit of being able to track changes that have been made in your codes and files over time.
- Github also provides the functionality called Github flavoured markdown which allows you to use simple text editor to write documents.
- Github coming with the facility of Branching has made it so much easier for coders to try out new logics and ideas without changing the master branch and once you are satisfied with the new changes you can easily merge them in the end.
- Github provides large community which means large number of coders and programmers you can reach out to in case you need help in brainstorming or to make your application better or if you need feedback.
- You can access to all these features and create a social network with other coders and all for free for you public repositories.
I hope you got to learn and take something from this blog.
And if you would like to learnmore about Github and its major role in DevOps along with a structured training, you can visit HERE .
Finally,that would be all for this blog but HERE is an informational video by intellipaat on “How to work with Git” which I believe will give you even more in-depth understanding of this tool and how it is used.
There will be a blog on more detailed use of the operations on github so don’t forget to visit again!