Git Quick Start

Git is a popular Version Control System or VCS like SvN and TFS for managing projects and tracking changes in computer files.
Look at the chart above, the interest of git is in perpetual growth since 2004.

Evolution of Git popularity since 2004

In this topic I will explain bravely basic Git commands.

To install Git go here git.

Create a new folder on your disk and open Git Batch console like this :

Git Bash

Init a Git Repository > git init

Type git init to create a local git repository or reinitialize an existing one. A .git directory will be created, it contains all necessary resources to manage the git repository.

init a git repository

Configure User and Email with Git Bash > git config

Type git config to set the configuration like and These variables are used to determine the author or the committer of changes.

configure Git Batsh

Add File to the Cache of a Git Repository > git add fileName

Type git add to add a file to the cache or staging area called index. This index is located here .git/index.

Add file to the cache or staging

Check Status of Working Tree > git status

Type git status to show working tree. It displays differences between staging and repository (HEAD).

check status

Open Git Gui > git gui

Type git gui to launch the graphical git interface

Git Gui

Remove File From the Cache > git rm --cached fileName

Type git rm to remove files from the cache (index).

remove file from the cache

Add Files to the Cache > git add . (or git add *)

Type git add ./* to add files to the cache or staging area (index).

Add files to the cache
Gui after adding files

Restore Working Tree Files > git checkout

Type git checkout to restore files to match with the version in the index.

remove file
restore file

Commit the File > git commit -m ‘commit message’

Type git commit to record changes to the repository (HEAD)

commit files

Use .gitignore File

.gitignore specifies files to be ignored by git.

using .gitignore file

Open .gitignore and Add Files to Ignore

Create Branch > git branch branchName

Type git branch to create a new branch.

create branch

Switch to a Branch > git checkout branchName

type git checkout to switch to another branch

switch branch

List Branches > git branch -- list

Type git branch --list to display all branches

list branches

Merge Branches > git merge branchName

type git merge to incorporate changes from the named branch to the current branch.

A--B--C--D---F/F/G- --> master
\ /
E--F--G --> Dev
merge branches

Push the Repository to GitHub > git remote/push

Type git remote add to map local repository with remote repository

push to gitHub

Push Changes to GitHub > git push

Type git push to update the remote repository from the local repository.

push changes to gitHub

Update Your Local Repository From GitHub > git pull

Type git pull to fetch from the remote repository and integrate to the local repository

pull changes from gitHub

Clone Repository > git clone

Type git clone to clone a repository into a new created directory.

Cloning repository

For more details see the git official website here.

Enjoy :)




Senior Full Stack .Net / Angular Developer, Cloud & Azure DevOps, Carrier Manager, Husband, and Father.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

CosmosDb vs Table Storage: write throughput comparison

Output Of The Week

Pandas (a Python Library)

Quick tips on Capybara

Flight Data APIs: Key tools for agency websites

Why does it take so long to finish software projects?

Deployment of Django application using fabric on nginx web server and celery setup

Unilayer adds $100k initial liquidity on PancakeSwap

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Abdelmajid BACO

Abdelmajid BACO

Senior Full Stack .Net / Angular Developer, Cloud & Azure DevOps, Carrier Manager, Husband, and Father.

More from Medium

Some Useful Git commands

Git Cheatsheet

Git basics