Basics of GitHub
By Sweta Panigrahi | 01-03-2018 10:57 AM | 1291 | 3
GitHub may sound complicated but once we understand it, it turns out to be no more than a simple social network. It is not very different from Facebook and Google plus. You sign up, sign in, upload projects, download projects, follow other users and many more things that make it very similar to a social network.
What is Git & GitHub?
Let's understand Git first. Linus Torvalds, the man himself created Git, the software that is same for GitHub as a kernel is for an OS.
- Git is a version control software. This is self-explanatory. It manages all the versions of a project. When we modify a piece of code, we usually over write it and thus, lose a working model. In case the new code breaks, rolling back is often very difficult.
- Let's assume a team is working on a project and everyone is editing the same file. If you are familiar with the race condition in OS, you can understand what I mean. When two or more member of the team try to modify a file at the same time, conflict occurs. If they are doing it at a different time, one may overwrite the code and thus deletes his part of code. git is the solution for the mentioned problem.
Now GitHub. The only problem with Git is that you have to everything by using the command line (terminal / console / konsole). Here comes GitHub. GitHub provides a visual interface to help and manage the project. You can create an account here and it gives more of a social network feel. You can browse through users' profile, check their projects, download a copy of it to your profile or computer or alter it. No data will be lost.
GitHub can be used without command line but there is a difference between using and understanding it. In this post, we will be working with git and GitHub using the command line.
Terms to know:
1. Repository : A directory where we can store our project.
2. Version control: A solution to losing the track of modifications without creating multiple copies.
3. Clone : downloading (cloning) any project to your local system.
4. Fork : A copy of a repository. Allows to modify / edit code without affecting the original project.
Steps to success:
1. Create an account. It is same as creating any social network account. Throw in a valid user name, email id and a password to start.
2. Install Git. if you are going to work in your computer with git, you need to install it. Use one of the following commands to install git.
As this is first-time hands on GitHub, I don't want to confuse everyone with making a local repository. We shall understand those concepts in next workshop.
here [dot] means everything that has been changed. You can also mention just the file name you want to add. In our case, &git add data.txt
commit is the keyword that saves and -m passes the comment parameter that will be seen in time line when having an eagle eye on the versions of the project.
It will prompt you to enter username and password, fill it and your files are up.
You can also visit this link to learn more about it.