Git and GitHub for Beginners #2

Abhishek Raghav
4 min readJun 18, 2020

Getting started with Git

First of all, go to the official website of Git and install git on your device. The installation process is simple, you can just follow the documentation given on the site and it will be installed easily.

Once the installation is complete, search Git Bash in your PC and open it. Git Bash is a terminal for git just like command prompt and powershell in Windows.

(PS: Git Bash is not compulsory to use. Git commands can be executed even in other terminals like command prompt or powershell.)

Basic commands and Set Up

  • Checking installation:

Once you open the Git Bash, type the first command:


On executing the above command, it gives a list of various commands which can be executing in Git. This helps us to check if git is properly installed in our system or not. The output will be something like this: (You can ignore the below code, it is just a check if git is properly installed.)

usage: git [--version] [--help] [-C <path>] [-c <name>=<value>][--exec-path[=<path>]] [--html-path] [--man-path] [--info-path][-p | --paginate | -P | --no-pager] [--no-replace-objects] [--bare][--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]<command> [<args>]These are common Git commands used in various situations:start a working area (see also: git help tutorial)clone     Clone a repository into a new directoryinit      Create an empty Git repository or reinitialize an existing onework on the current change (see also: git help everyday)add       Add file contents to the indexmv        Move or rename a file, a directory, or a symlinkrestore   Restore working tree filesrm        Remove files from the working tree and from the indexexamine the history and state (see also: git help revisions)bisect    Use binary search to find the commit that introduced a bugdiff      Show changes between commits, commit and working tree, etcgrep      Print lines matching a patternlog       Show commit logsshow      Show various types of objectsstatus    Show the working tree statusgrow, mark and tweak your common historybranch    List, create, or delete branchescommit    Record changes to the repositorymerge     Join two or more development histories togetherrebase    Reapply commits on top of another base tipreset     Reset current HEAD to the specified stateswitch    Switch branchestag       Create, list, delete or verify a tag object signed with GPGcollaborate (see also: git help workflows)fetch     Download objects and refs from another repositorypull      Fetch from and integrate with another repository or a local branchpush      Update remote refs along with associated objects'git help -a' and 'git help -g' list available subcommands and someconcept guides. See 'git help <command>' or 'git help <concept>'to read about a specific subcommand or concept.See 'git help git' for an overview of the system.
  • Checking git version:

Type in the following command to check your git version:

git --version

It will give output something like this:

git version
  • Checking status of our repository:

Type in the following command:

git status

Executing the above command will give us a warning:

fatal: not a git repository (or any of the parent directories): .git

The above warning is because currently we have not initialized any repository. Thus, we first need to initialize a git repository before checking its status.

  • Initializing a Git Repository:

First go to any folder containing your project. (It can even be an empty folder.) Open the Git Bash over there and type the following command:

git init

The above command initializes an empty git repository in your directory, and gives output something like this:

Initialized empty Git repository in D:/gitMediumBlog/.git/

Now try checking status of your repository using the command stated earlier. The output will be something as follows:

On branch masterNo commits yetUntracked files:
(use “git add <file>…” to include in what will be committed)
nothing added to commit but untracked files present (use “git add” to track)

So congratulations! You have been able to make your first git repository!

At this stage, you might be curious to know about other git commands like “git add” and “git commit” but before that you should have a thorough knowledge of Git architecture, which will be discussed in my next blog.

Just knowing the git commands is not fruitful, you should even know what goes behind the scenes

Half-knowledge is worse than ignorance.

Thanks for reading :)
Do post your comments and give a clap if you think my article is worth it.



Abhishek Raghav

Hey there! I am an undergrad at IIT Jodhpur (2019–23) pursuing B. Tech. in CSE. Being a tech enthusiast, I love to gain and share knowledge about tech content.