Git essential commands

Git essential commands

In this article we will explore git and some important commands to use Git.  As you know Git is used for version control. There are some commands that are used by developers on daily basis while committing.  Here are some useful Git commands.

Make  Changes

Initializing a git repository. (To create a new git repository).

Lists all new or modified files to be committed

Shows the file differences not yet staged

Snapshots the file in preparation for versioning

Shows file differences between staging and the last file version

Unstages the file, but preserves its contents

Committing a file –  File snapshots permanently in version history. We have to add a message describing the change made.


Sets the name you want attached to your commit transactions

Sets the email you want attached to your commit transactions

Enables helpful colorization of command line output

Creating Repositories

Start a new repository or obtain one from an existing URL

Creates a new local repository with the specified name

Downloads a project and its entire version history

Git Branches

Name a series of commits and combine completed efforts

Lists all local branches in the current repository

Switches to the specified branch and updates the working directory

Combines the specified branch’s history into the current branch

Deletes the specified branch

Synchronize Changes

Register a repository bookmark and exchange version history

Downloads all history from the repository

Combines bookmark’s branch into current local branch

Uploads all local branch commits to GitHub

Refactor Filename

Relocate and remove versioned files

Deletes the file from the working directory and stages the deletion

Removes the file from version control but preserves the file locally

Changes the file name and prepares it for commit

Save Fragments

Shelve and restore incomplete changes

Temporarily stores all modified tracked files

Lists all stashed changesets

Restores the most recently stashed files

Discards the most recently stashed changeset

Redo Commits

Erase mistakes and craft replacement history

Undoes all commits after commit, preserving changes locally

Discards all history and changes back to the specified commit

Review History

Browse and inspect the log history of project files

Lists version history for the current branch

file Lists version history for a file, including renames

Shows content differences between two  branches

Outputs metadata and content changes of the specified commit

These are some basic commands used by developers in their day to day work.  thanks for reading and do visit again to have more inflammatory articles.