Translate

Monday, 7 April 2014

What is Github ?


If you belong to coding world, you might be familiar with Github and if you are not, be ASAP!!!
I am presenting you a 'Get Started' guide that will make you up and running with Github.

Github is the largest open source community  where the open source enthusiasts share their codes for others to see and better, modify. It is a great platform for developers across the world to collaborate on projects cutting across geographical boundaries. 
One big misconception people have regarding Github is that it is only for pros, but the case is Github is for pro and novice alike. In fact it is a great way for novices to learn by forking the repos and playing with them. Github has a very large collection of repositories in almost all languages to get you started and keep on going.
Github is a version control system based on Git. A version control refers to maintaining the versions of a software. When different people work on the same project they branch out of the repository and work on them independently, they later merge their branches to complete the project. Also there may be situations where you have to test some assumptions, in those cases you can branch out of the master and test your assumption. If your assumption is correct, you can merge your branch with master else you can ignore that. Meanwhile Git keeps screenshot of previous version of the project so when you want to revert back some changes, you can easily do that.

BTW what is a Repository ?
A repository or repo as it is commonly called, acts as the container for your project. Everything related to your project, the source code files, images, readme.md, configuration files and so on.

Get started with Github

Enough of lecture, its time for action now!! I will now be providing you a short tutorial to get started with github. The very first step is to install git. Git is the language on which github is based and apparently git commands are used for all the operations in github. If you are a ubuntu user, the installation is pretty simple for you. Open the terminal and type the following commands:

$ apt-get install git

If you are a Fedora user,open the terminal and type the following:

$ yum install git

For Windows and Mac users you need to download git from here
Now go to Github and create your account. Its fairly simple and should not take much time. After that create a repository. For example I have created the repository RetailManagement. Add some detail regarding the project in readme.md.


After creating your account on Github and installing git, it is time for configuring your account with the installed git. For configuration, open the git bash(Linux users simply open your terminal) and type following commands:

$ git config --global user.name "Your user name"

$ config --global user.email "your email id"

After creating the repository on Github, create a folder of same name in your local machine, it is where you will put all your code and other stuff. I have created the folder for 'RetailManagement' repository in my local machine. Now migrate to the folder location and type following:

init command is used to initialize the git repository in local machine. After executing this you will notice a .git folder in your folder. After initialization, it is now time to add files to the repository.


After adding the file, we need to commit the change; committing means you are finalizing the changes you made through add command.


add and commit commands adds the file to the local repository, however for uploading the files to the github account, we need to synchronize the local repository with the repository created on github. For this, following command is used.


Now its time to push the files to the github server. however, if you have initialized with a readme.md file while creating the repo on github, you will see following error upon pushing.


It is where pull comes into action. pull command is used to merge the files which are there on the github server to the local repository.


Now try pushing, this time you will successfully be able to push.


Thats it !! you are good to go now.

Open source is all about having access to others' code for you to make changes, fix bugs etc. If you want to contribute to others' project, you need to Fork that repository. By forking you are branching out of that project. You can work independently on it. Later when you want to merge your branch with the master, send a Pull Request to the administrator of the master. He will review your changes and if convinced, will merge your branch. 

Monday, 22 July 2013

Hi tech enthusiast. Here I start with blogging. I  share a deep compassion with you for everything associated with computers,but programming is my real passion and profession as well. In the coming posts I will share with you some of the interesting stuffs related to programming and the underlying hardware. I encourage you to share your knowledge with us in the comments. Stay tuned for the interesting stuffs on the way..!! Happy coding..