Understanding Zero To Master Git Commands

Posted By Piyush Makhija | 30-Nov-2018

Hi Viewers;

This blog is created to help you all to learn Git commands ZERO to Master. In this blog i will explain all the command's which are commonly used in github and also some tricks to handle the git with ease.


Git Commands :-


1) git init :-

    Purpose :- It will create an empty Git repository or reinitialize an existing one.

    Synopsis/Syntax :git init

    Description:- This command creates an empty Git repository.

    Example:- git init


2) git add :-

    Purpose :- It is used to add file contents to the index

    Synopsis/Syntax :- git add [-A]

    Description :- This command will be performed multiple times before a commit. It only adds the content of the specified file at the time. If you want to add all the files at one time you can use option -A with git add.

    Example :- git add filename. (This will add the one file)  /   git add -A (This can add all the files)


3) git status :-

    Purpose :- This will show how many files content has been changed

    Synopsis/Syntax :- git status

    Description :- This will show the path to the files which are changed currently at your local repository.

    Example :- git status


4) git commit :-

    Purpose :- Record changes to the repository

    Synopsis/Syntax :- git commit -m "message to the commit"

    Description :- Stores this contents of the index in a very new commit beside a log message from the user describing the changes.

    Example :- git commit -m "message for the commit"


You can start a new Git repository for an existing code base

            $ cd /path/to/my/codebase   

            $ git init (1)

            $ git add . (2)

            $ git commit (3)

Create a /path/to/my/codebase/.git directory.

Add all existing files to the index.

Record the pristine state because the 1st commit within the history.

Request for Proposal

Recaptcha is required.

Sending message..