What is git ?

Future Techno India
6 min readMar 26, 2022


Git is a free and open-source version control system that can handle both small and large projects with ease.

Git is easy to learn and has a small footprint while providing lightning-fast performance. It offers more features than Subversion, CVS, Perforce, and ClearCase, such as cheap local branching, convenient staging areas, and multiple workflows.

GIT / Future Techno India

Basic commands of GIT

git config

A convenient way to configure your Git installation. On a new development machine, you’ll typically only need to use this right after installing Git.

You can use this command to specify the author name and email address for each of your commits.

Usage: git config — global user.name “<name>”

Usage: git config — global user.email “<email address>”

git init

Creates/initializes a new Git repository. It is the first command you need to know if you want your project to be under revision control.

This command is used to start a new repository.

Usage: git init <repository name>

git clone

Copies a Git repository. The most common method for developers to get a working copy of a central repository is by cloning.

This command is used to obtain a repository from an existing URL.

Usage: git clone <URL>

git add

Changes are moved from the working directory to the staging area. As a result, you can prepare a snapshot before committing it to the official history.

This command adds a file to the staging area.

Usage: git add <file_name>

This command adds one or more to the staging area.

Usage: git add *

git commit

Commits the staged snapshot to the project history. Together with git add, this defines the basic workflow for all Git users.

This command records or snapshots the file permanently in the version history.

Usage: git cammit <file_name> -m “type in the commit massage”

This command commits any files you’ve added with the git add command and also commits any files you’ve changed since then.

Usage: git cammit -a

git status

This displays the state of the working directory and the staged snapshot. To see what’s included in the next snapshot, you’ll also want to run git add and git commit.

This command lists all the files that have to be committed.

Usage: git status

git show

It is used to view expanded details about Git objects such as blobs, trees, tags, and commits. Each object type has its own behavior. Tags show additional objects that are associated with the tag. In a tree, names and content of objects are displayed.

This command shows the metadata and content changes of the specified commit.

Usage: git show

Usage: git show <commit >

git log

Provides access to previous revisions of a project. Provides a variety of formatting options for displaying committed snapshots.

This command is used to list the version history for the current branch.

Usage: git log

The oneline option displays the output with one commit per line.

Usage: git log — oneline

git branch

You can use this command to perform general branch administration tasks. This command allows you to create isolated development environments within one repository.

This command lists all the local branches in the current repository.

Usage: git branch

Usage: git chechout -b <branch_name>

This command creates a new branch and switch also in the new baranch.

Usage: git branch -d <branch_name>

This command deletes the feature branch.

git checkout

Besides allowing you to check out old commits and file revisions, git checkout also allows you to navigate existing branches. Combined with the basic Git commands, it provides a way to work on a particular line of development.

This command is used to switch from one branch to another.

Usage: git checkout <branchname>

git merge

Merging is Git’s way of putting a forked history back together again. You can merge the independent lines of development created by git branch by using the git merge command.

This command merges the specified branch’s history into the current branch.

Usage: git merge <branch_name>

You can check by the “git log –oneline” as you see in the image before merging and after merging

git diff

This command shows the file differences which are not yet staged.

Usage: git diff <first_commit> <second_commit>

git clean

This is builtin command to cleanup the untracked files. Be careful with this one, it deletes files permanently!

Always add -n or — dry-run options to preview the damage you’ll do!

  • If you just clean untracked files, run git clean -f
  • If you want to also remove directories, run git clean -f -d
  • If you just want to remove ignored files, run git clean -f -X
  • If you want to remove ignored as well as non-ignored files, run git clean -f -x

Usage: git clean <option>

git rm

This command deletes the file from your working directory and stages the deletion.

Usage: git clean <option>

git remote

This command is used to connect your local repository to the remote server.

Usage: git remote add <variable_name> <remote_server_link>

After this you can push your files in GitHub by git push command

Usage: git push <variable_name> <branch(master)>

git pull

This command fetches and merges changes on the remote server to your working directory.

Usage: git pull <repository_url>



Future Techno India

We believe in making future tech leaders by providing right education to them. https://www.payumoney.com/webfronts/#/index/Expertise-on-Container