Skip to content
Hardikb19 edited this page Dec 2, 2019 · 5 revisions

Introduction to Github

Github-logo

Github is a free and open-source version control system, that helps you keep track of changes to files in a filesystem/repository over time. It has been an industry standard for a while now. Git comes with the git-shell which has a set of nifty commands that can help you do all sorts of things on your repositories.

Github is a service that hosts your repositories online and lets you collaborate with others through it. You can use Github through the browser or the git-shell on your pc.

How to Install Git and Github

  • Installing Git on Windows

    Download Git from Git for Windows and install it

  • Installing Git on Linux

Determine onwhich Linux distribution your system is based on. See List of Linux distributions – Wikipedia for a list. Most Linux systems – including Ubuntu – are Debian-based.

Debian-based linux systems

Open a terminal window. Copy & paste the following into the terminal window and hit Return. You may be prompted to enter your password.

sudo apt-get update
sudo apt-get upgrade
sudo apt-get install git

You can use Git now.

  • Installing Git on a Mac

Open a terminal window.

Step 1 – Install Homebrew

Homebrew simplifies the installation of software on the Mac OS X operating system.

Copy & paste the following into the terminal window and hit Return.

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew doctor

You will be offered to install the Command Line Developer Tools from Apple. Confirm by clicking Install. After the installation finished, continue installing Homebrew by hitting Return again.

Step 2 – Install Git

Copy & paste the following into the terminal window and hit Return.

brew install git

You can use Git now.

Commands you'll need in this project

First, create a Github ID, then move on.

  • Clone the IECSE Dev Winter Project repository
    git clone https://github.com/Hardikb19/IECSE-Dev-Winter-19.git

  • Initialize a repository in the directory(this is just for information, you won't need this for any task) git init <Project Name>

  • Create a branch
    git checkout -b <branch-name>

  • Change into another branch
    git checkout <branch-name>

  • Adding Files to be committed
    git add <filename1> <folder_name>\<filename2> - Adds filename1 in current directory and filename2 in the folder.
    git add . - Adds all files in the current directory

  • Adding a commit message
    git commit -m "<message>"

  • checking status of files
    git status

  • Pushing the committed changes to the GitHub repository
    git push origin <branch-name>
    Note: Never push to the master branch, create your own branch and change into that and then push.

  • Pulling changes from the GitHub repository
    git pull origin <branch-name>

A detailed article on Git and Github: https://medium.com/@abhishekj/an-intro-to-git-and-github-1a0e2c7e3a2f