Git and GitHub for Beginners #2

Getting started with Git

Basic commands and Set Up

  • Checking installation:
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:
git --version
git version
  • Checking status of our repository:
git status
fatal: not a git repository (or any of the parent directories): .git
  • Initializing a Git Repository:
git init
Initialized empty Git repository in D:/gitMediumBlog/.git/
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)



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
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.