---
# System prepended metadata

title: GIT AND GITHUB

---

Hello dear's, this article will focus mainly on Git and GitHub.

WHAT IS Git?

Git is a distributed version central system (VCS) that helps developers to track changes in their code base, collaborate with other users and manage multiple versions of a project. Simply put, Git is use to back up a code.

Git is decentralized, which means it does not require a central server. Instead, every devoloper has a full copy of the repository or repo on their machine.

A repository  or repo can be a digital file that allow developers to make changes on their code, allows different users to work on the same project without stepping on each others toe. It also stores all your files and keep track of changes that are made on the file or project that your working on. It span across one person to even giant companies like google, microsoft, facebook.


KEY FEATURES

DISTRIBUTED SYSTEM - Means is decentralized therefore no need for central server.

VERSION TRACKING - It keep track of changes made to your code.

COLLABORATION - Multiple developers can work on thesame project.

BRANCHING - Adding other features into the code.

MERGING - Merging the features that has been added into the code.

REMOTE REPOSITORY - Or Repo are files that has been successfully added to the platform for example Github. 

EXTENSIVE TOOLING - Supported by many tools including IDE.

STAGING AREA - Put files before commititng them to local repositories.

SPEED - Fast and efficient.

OPEN SOURCE and FREE - Is available without licensing and contain features for plugins.


GITHUB

Is a web-base platform designed for version control and collaboration. It host git repositories (remote repo) and provides interface to manage your code and do other things as well. Github offers powerfull collaboration tools like bug tracking, feature requests, task management and wikis. Git is the tool use to create these repositories and push the code to the platform (Github).

Github offers remote services and also provides a space for easy collaborations between developers. Git is the version control system (VCS) while Github is the platform that hosts repositories. 

USE OF GIT

When it comes to using Git, there are two options to use, which are;
	
1. Terminal: This is where the user type commands. These commands direct the code  to the target destination. The terminal is regarded as 	the most recommended way of using Git because it is more powerful and the user will have a better understanding of what's happening 		behind the scene.
	
2. Tools with GUI (Graphic User Interface): The use of GUI doesn't allow the user to actually spot or recognise what is happening behind 		the scene.

CONFIGURING GIT

When you start using Git, the user needs to configure it with a Name and email address. This is important because every Git command uses the information.
	
	Configuring the Git can be achieved using the following commands
	
	git config --global user.name "Your username"
	git config --global user.email "Your email"

GIT WORKFLOW

The Git workflow is a step by step process which involves moving of project from one area to another till it reaches the target area (Remote Repository). This include;
	
1. Working Directory: Also known as the project folder; is where the user makes changes to the file. 
	
2. Staging Area: It is where you prepapre your file for commit.
	
3. Local Repository: Here, Git stores all the changes made in the file which is all stored in a hidden folder called '.git' in your 		project directory
	
4. Remote: The remote repository provides the platform for other collaborators to have access to your code. It also allow other users to 		be able to track progress or changes made to the code.
	
Here are some of the commands to move the files from one area to another.

- Open the terminal in the desired code editor for example, Visual studio Code (VS code)
	
- Type the command git init (git init) and press enter: This initiate a new repository in your project folder (working directory). It aslo 	 creates a hidden folder call .git
	
- Next we type git add (git add) and press enter: This will add your files to the staging area.
	
- Type git commit and add a comment then press enter (git add "First commit"): This command commit your files to your local repository on 	your machine. The comment explains what the commit is all about. 

- To push to your remote repository or repo, type git push and press enter (git push): Remote repository could be either Github, GitLab, or BitBucket.
	
- To pull changes from the remote repository to your local machine, type git pull (git pull): This command helps to pull changes that 		other users have made to your file.
	
- Cloning a file to your local machine is by typing the command git clone (git clone): This command is run when a user wants to start 		working on an existing project.
	
BRANCHING AND MERGING

Branching is a key feature of Git. It allows the user to work on new features or bug fixing without affecting the main code base. This 		feature allows the user to create a new branch, make a change, then match these new changes into the main branch. You can also create 		branches for different envitornments like Production, Staging and development. 

GETTING CODE FROM GITHUB

Downloading; an entire zip of the repo by clicking the code button and click on Download zip. This feature is for individuals that just 		want the code downloaded on their local machine.
	
Git clone; which is, getting a copy of the full repo on your machine.
	
Git fetch; is when you want to get the latest changes from the remote repo but you don't want to merge them. 
	
Forking; is copying repository from platform unto platform within your own account.
	 
