Nadeem's blog

Git & GitHub

work in progress, last updated: May 3, 2020

Introduction

This article is to help you to get familiar with Git and GitHub. GitHub is an online platform, that help developers to share codes and resources online. Git is an open-source version control software that helps developers to collaborate and modify codes without the headech of using emails and shared cloud tools. it also helps them to track changes to the code and retrieve previous versions of the code. Using Git, developers can retrieve and upload codes from and to GitHub, giving them the ability to work on the code locally before pushing it up to the platform. This article is meant for Linux users, but most of the information is also valid for Windows and IOS users.

Installing Git on Ubuntu

Open your terminal, and update your packages. You might be asked to provide the administrator password

sudo apt update

Install the lastest release using apt-get

sudo apt-get install git

Define your default username and email, by using the following two commands

        
        git config --global user.name "Your User Name"
        git config --global user.email "your.email@domain.com"
        
      

Starting with Git

After creating a new repo in your GitHub, you can start working on your project. but first let's move your project to your computer. This way, you can work on the code localy using your favorate coding software. To do so, you need to clone your repo form GitHub, and use the git clone command.

git clone https://github.com/YourUserName/YourRepo.git

To check your repo status use

git status

Controling your repo

Adding changes to your repo


        git add.
        git add file-name.extention
      

Committing changes to your repo


        git committ -m "put a description of the changes you are committing"
      

Pushing changes to your repo, you might be asked to enter you username and/or password


        git push