Wednesday 7 June 2017

Git & GitHub - 1 Basics

Hi friends,

I have seen many students throughout my undergraduate and graduate studies trying to use Git & GitHub and failing interest soon enough due to lack of good available resources. So, I decided to write myself to help beginners start using Git & GitHub with whatever little knowledge I have on these.

So, let's begin understanding about these two terms first.

Git:  Git is a version control software i.e. while you are building a programming application you can save each little change you make to the application. So, if you make any mistake or you just want to see the previous version of the application to see how it looked before, we can do that using Git. Git is also an open-source application. You can know more about Git from the official Git Website

GitHub: GitHub on the other hand is a collaboration website which always users to publish their Git repositories on the GitHub website. The official page of GitHub can be reached using the GitHub Page Link. GitHub is thus a collaboration tool used by people to interact with Git. 

Now, that we know the difference between the two, we can start learning how to use GitHub. There are five major steps while working with a GitHub project:
  1. Branching - Suppose, we have a working code which is available on a GitHub repository. This is also called as the master. This step is making a branch of the master directory i.e. making the copy of the master before we can make any changes to avoid the application to stop working due to the changes. 
  2. Commit - It is sort of like making changes to the created branch. Whenever we commit the changes made to the code, it stores all of the changes made by creating a snapshot of the project. 
  3. Pull Request - Once we have mode some commits to the project, we open a pull request to the GitHub Website. The pull request compares the branch in which we have made changes to some other branch (may be master). This allows us to see the differences between the two branches to show other people the changes we have made. 
  4. Collaborate - After the pull request, you can collaborate if you find the changes made to the branch are correct. This allows the users to give suggestions about the changes made to the branch which may require to make further changes and do the above steps again.  
  5. Merge - Once the changes made to the branch are accepted, we merge the branch we created and the changes we made and replace it with the master. 
If you want to make changes to an application that is not yours then we require an additional step called Fork.

Fork: Fork creates an exact copy of a Git repository under your GitHub account and you can start using the repository using the above discussed steps.

Cloning Repositories: Sometimes, we may need to download the Git repository and work locally on our computers in case of non-availability of internet. In such as case, we need to clone repositories to start working locally on our computer. The changes made to the cloned repository are not visible on the repository hosted on the GitHub website. 

Now, we see some commonly used Git commands. 
  1. git clone
  2. git pull
  3. git branch
  4. git status
  5. git add
  6. git commit
  7. git push
That's it knowing the basics of Git & GitHub. In the next post, we'll see a detailed step by step process of using these commands for GitHub.
Share:

0 comments:

Post a Comment

Contact Me

Name

Email *

Message *

Popular Posts