SlideShare a Scribd company logo
03/18/16 NOS Conf 2016
Version control system with git
and (github) as an example
Gaurav Garg
@gaurav_garg_
ggarg@redhat.com
freenode irc nic: ggarg
03/18/16 NOS Conf 2016
Agenda

VCS – What is it ?

Why using a VCS is good idea

Git Basic including:
➢How to obtain and install Git
➢How to use it for basic/common operation
➢More information resource for Git

Q & A
03/18/16 NOS Conf 2016
VCS What is it ?
• A way to keep track of changes to files or folders
• Keep record of changes why, what, when
• Non distributed system (subversion, CVS)
server has the master repo, all commit goes to the server
• Distributed (Git, mercurial)
server has the master repo, but you have copy of that repo
(clone) in your machine
03/18/16 NOS Conf 2016
Getting Git
•Dependencies:
* on a system that has yum (such as fedora)
$ yum install curl-devel expat-devel gettext-devel 
openssl-devel zlib-devel
* on a system that has apt-get (debian based system)
$ apt-get install libcurl4-gnutls-dev libexpat1-dev gettext 
libz-dev libssl-dev
03/18/16 NOS Conf 2016
Getting Git cont...
•Get the latest snapshot from git website:
http://git-scm.com/download
Then, compile and install:
$ tar -zxf git-1.7.2.2.tar.gz
$ cd git-1.7.2.2
$ make prefix=/usr/local all
$ sudo make prefix=/usr/local install
03/18/16 NOS Conf 2016
Getting Git cont...
• Binary Installer:
If you want to directly install binary then:
 For Fedora:
$ yum install git
 For debina based distribution:
$ apt-get install git
 For mac
$ brew install git
03/18/16 NOS Conf 2016
Git basic operation
•Checking the installation:
Check if Git is installed
$ git - -version
git version 1.9.3
If not then follow the installation steps that mentioned in previous slides.
• Setting user name and email to your git config:
$ git config --global user.name "Gaurav Kumar Garg"
$ git config --global user.email " ggarg@redhat.com"
Note: If you want to set it for specific repositery then cd to that repositery and
Remove “--global” option.
$ git config - -list command will verify user name and email address
03/18/16 NOS Conf 2016
Git basic operation cont...
• Obtaining a repository:
Creating a repository (if it does not exist remotely)
$ git init (follow http://git-scm.com/docs/git-init for more information)
Or cloning a remote repository:
git clone ssh://[username@]git.gluster.org/glusterfs.git glusterfs
For eg: cloning a gluserfs repository:
git clone ssh://ggarg@git.gluster.org/glusterfs.git glusterfs
here glusterfs is optional, which will be the name of repository.
Inspecting a repo: $ vim .git/config
03/18/16 NOS Conf 2016
Git basic operation cont...
• Inspecting repo:
$ git tag
will show you list of all tags (versioning of software)
$ git status
Difference b/w index file and current head commit
$ git log
Sow list of all commit with commit message
$ git log -1
Show top 1st commit
$ git log - -pretty=oneline
Show list of all commit in single line
03/18/16 NOS Conf 2016
Git basic operation cont...
• Making edit and commiting
• Edit your file with your fav editor (vim/emac etc.) and save it.
• $ git diff
will show delta difference code of current master HEAD and current index
• $ git status
will show path of file as “Changes not staged for commit”
• $ git add (-A)
will show file as “Changes to be commited”
• $ git commit -s
write your commit message. Save and exit.
* file changed, * insertion, * deletion (-)
• Check your commit by $ git log
03/18/16 NOS Conf 2016
Git basic operation cont...
• Recover your changes that you have added by
mistakes
$ git add <file name>
file <file name> that you have added by mistake
$ git status
$ git reset HEAD <filename>
$ git checkout - - <filename>
03/18/16 NOS Conf 2016
Git basic operation cont...
• Best pratice is to make seperate branch
$ git branch <branch name>
or
$ git checkout -b <branch name>
$ git branch -D <branch name>
will delete branch <branch name>
$ git branch -m <branch name> <new name>
will rename branch <branch name > with <new name>
03/18/16 NOS Conf 2016
Git basic operation cont...
• Git Stashing
Will allow you to save your changes without commiting them.
• $ git stash
save your change as a seperte stash@{*} branch with commit
message
• $ git stash list
will show you list of all stash with commit message
• $ git show <stash@{0}>
will show you what code difference contain this this stash@{0}
• $ git apply <stash@{0}>
will allow to apply change in current branch.
03/18/16 NOS Conf 2016
Git basic operation cont...
• Git rebase
forward-port local commit to local upstream master
• $ git rebase master
* will update your local commit with master
• $ git rebase -i HEAD~3
* will pick up top 3 commit and it
* can be use for reword, edit, squash commit
03/18/16 NOS Conf 2016
Git basic operation cont...
• Adding remote:
• $ git remote add <remote name> <remote_url>
Adding remote repo address in your local machine
user can add multiple remote repo address
• $ git remote -v
will show you list of all remote address with name
• $ git push <remote name> <branch name>
will push <branch name> change to remote address
03/18/16 NOS Conf 2016
Git basic operation cont...
• Git tagging
• $ git tag
* will list out all the tags (calles as versioning of
software)
• $ git tag -a <tag name> -m “tag description”
* will give tag with tag name of tag version with
current branch HEAD
• $ git tag -d <tag name>
* Delete tag <tag name>
03/18/16 NOS Conf 2016
More information resource for Git
• $ git - -help
for eg: git - -help <rebase>
will give your help regarding “git rebase”
• http://git-scm.com/docs/
contains resource of all git related command/operations.
03/18/16 NOS Conf 2016
Thank you....
03/18/16 NOS Conf 2016
Q/A
Ad

More Related Content

What's hot (20)

Git and GitHub workflows
Git and GitHub workflowsGit and GitHub workflows
Git and GitHub workflows
Arthur Shvetsov
 
Git tutorial
Git tutorialGit tutorial
Git tutorial
mobaires
 
Git commands
Git commandsGit commands
Git commands
Viyaan Jhiingade
 
Git basics
Git basicsGit basics
Git basics
Denys Haryachyy
 
Git intro hands on windows with msysgit
Git intro hands on windows with msysgitGit intro hands on windows with msysgit
Git intro hands on windows with msysgit
Geshan Manandhar
 
Version Control with Git
Version Control with GitVersion Control with Git
Version Control with Git
Luigi De Russis
 
Git tutorial
Git tutorial Git tutorial
Git tutorial
TingYen Lee
 
Git
GitGit
Git
Gayan Kalanamith Mannapperuma
 
Git presentation
Git presentationGit presentation
Git presentation
Vikas Yaligar
 
Git and fundamentals
Git and fundamentalsGit and fundamentals
Git and fundamentals
Naincy Gupta
 
Advanced Git Tutorial
Advanced Git TutorialAdvanced Git Tutorial
Advanced Git Tutorial
Sage Sharp
 
01 - Git vs SVN
01 - Git vs SVN01 - Git vs SVN
01 - Git vs SVN
Edward Goikhman
 
Advanced Git Presentation By Swawibe
Advanced Git Presentation By SwawibeAdvanced Git Presentation By Swawibe
Advanced Git Presentation By Swawibe
Md Swawibe Ul Alam
 
Extra bit with git
Extra bit with gitExtra bit with git
Extra bit with git
gdgjss
 
Git Tricks
Git TricksGit Tricks
Git Tricks
Ivelina Dimova
 
Git
GitGit
Git
Hanokh Aloni
 
Intro to Git DevOps Tally Presentation 101615
Intro to Git DevOps Tally Presentation 101615Intro to Git DevOps Tally Presentation 101615
Intro to Git DevOps Tally Presentation 101615
Brian K. Vagnini
 
Git vs svn
Git vs svnGit vs svn
Git vs svn
Suman Mukherjee
 
Extra bit with git
Extra bit with gitExtra bit with git
Extra bit with git
Himanshu Agrawal
 
Git - Get Ready To Use It
Git - Get Ready To Use ItGit - Get Ready To Use It
Git - Get Ready To Use It
Daniel Kummer
 

Similar to Version Control Systems with git (and github) as an example (20)

390a gitintro 12au
390a gitintro 12au390a gitintro 12au
390a gitintro 12au
Nguyen Van Hung
 
Understanding about git
Understanding about gitUnderstanding about git
Understanding about git
Sothearin Ren
 
sample.pptx
sample.pptxsample.pptx
sample.pptx
UshaSuray
 
Git and github 101
Git and github 101Git and github 101
Git and github 101
Senthilkumar Gopal
 
Git setuplinux
Git setuplinuxGit setuplinux
Git setuplinux
Shubham Verma
 
GitSetupLinux
GitSetupLinuxGitSetupLinux
GitSetupLinux
Shubham Verma
 
git-and-bitbucket
git-and-bitbucketgit-and-bitbucket
git-and-bitbucket
azwildcat
 
Getting some Git
Getting some GitGetting some Git
Getting some Git
BADR
 
GTFO: Git Theory For OpenSource
GTFO: Git Theory For OpenSourceGTFO: Git Theory For OpenSource
GTFO: Git Theory For OpenSource
Forest Mars
 
Basic git
Basic gitBasic git
Basic git
Casper Chen
 
Git
GitGit
Git
Terry Wang
 
Git 入门与实践
Git 入门与实践Git 入门与实践
Git 入门与实践
Terry Wang
 
Git 入门 与 实践
Git 入门 与 实践Git 入门 与 实践
Git 入门 与 实践
Terry Wang
 
Git walkthrough
Git walkthroughGit walkthrough
Git walkthrough
Mahmoud Said
 
Git session Dropsolid.com
Git session Dropsolid.comGit session Dropsolid.com
Git session Dropsolid.com
dropsolid
 
簡單介紹git
簡單介紹git簡單介紹git
簡單介紹git
Grace Chien
 
Working in Team using Git in Unity
Working in Team using Git in UnityWorking in Team using Git in Unity
Working in Team using Git in Unity
Rifauddin Tsalitsy
 
Introduction to Git and Github
Introduction to Git and Github Introduction to Git and Github
Introduction to Git and Github
Max Claus Nunes
 
Git and Github workshop GDSC MLRITM
Git and Github  workshop GDSC MLRITMGit and Github  workshop GDSC MLRITM
Git and Github workshop GDSC MLRITM
gdsc13
 
Exprimiendo GIT
Exprimiendo GITExprimiendo GIT
Exprimiendo GIT
betabeers
 
Understanding about git
Understanding about gitUnderstanding about git
Understanding about git
Sothearin Ren
 
git-and-bitbucket
git-and-bitbucketgit-and-bitbucket
git-and-bitbucket
azwildcat
 
Getting some Git
Getting some GitGetting some Git
Getting some Git
BADR
 
GTFO: Git Theory For OpenSource
GTFO: Git Theory For OpenSourceGTFO: Git Theory For OpenSource
GTFO: Git Theory For OpenSource
Forest Mars
 
Git 入门与实践
Git 入门与实践Git 入门与实践
Git 入门与实践
Terry Wang
 
Git 入门 与 实践
Git 入门 与 实践Git 入门 与 实践
Git 入门 与 实践
Terry Wang
 
Git session Dropsolid.com
Git session Dropsolid.comGit session Dropsolid.com
Git session Dropsolid.com
dropsolid
 
Working in Team using Git in Unity
Working in Team using Git in UnityWorking in Team using Git in Unity
Working in Team using Git in Unity
Rifauddin Tsalitsy
 
Introduction to Git and Github
Introduction to Git and Github Introduction to Git and Github
Introduction to Git and Github
Max Claus Nunes
 
Git and Github workshop GDSC MLRITM
Git and Github  workshop GDSC MLRITMGit and Github  workshop GDSC MLRITM
Git and Github workshop GDSC MLRITM
gdsc13
 
Exprimiendo GIT
Exprimiendo GITExprimiendo GIT
Exprimiendo GIT
betabeers
 
Ad

Recently uploaded (20)

DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptxDevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
Justin Reock
 
Electronic_Mail_Attacks-1-35.pdf by xploit
Electronic_Mail_Attacks-1-35.pdf by xploitElectronic_Mail_Attacks-1-35.pdf by xploit
Electronic_Mail_Attacks-1-35.pdf by xploit
niftliyevhuseyn
 
Automation Hour 1/28/2022: Capture User Feedback from Anywhere
Automation Hour 1/28/2022: Capture User Feedback from AnywhereAutomation Hour 1/28/2022: Capture User Feedback from Anywhere
Automation Hour 1/28/2022: Capture User Feedback from Anywhere
Lynda Kane
 
"PHP and MySQL CRUD Operations for Student Management System"
"PHP and MySQL CRUD Operations for Student Management System""PHP and MySQL CRUD Operations for Student Management System"
"PHP and MySQL CRUD Operations for Student Management System"
Jainul Musani
 
Into The Box Conference Keynote Day 1 (ITB2025)
Into The Box Conference Keynote Day 1 (ITB2025)Into The Box Conference Keynote Day 1 (ITB2025)
Into The Box Conference Keynote Day 1 (ITB2025)
Ortus Solutions, Corp
 
tecnologias de las primeras civilizaciones.pdf
tecnologias de las primeras civilizaciones.pdftecnologias de las primeras civilizaciones.pdf
tecnologias de las primeras civilizaciones.pdf
fjgm517
 
Build Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For DevsBuild Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For Devs
Brian McKeiver
 
Image processinglab image processing image processing
Image processinglab image processing  image processingImage processinglab image processing  image processing
Image processinglab image processing image processing
RaghadHany
 
Cyber Awareness overview for 2025 month of security
Cyber Awareness overview for 2025 month of securityCyber Awareness overview for 2025 month of security
Cyber Awareness overview for 2025 month of security
riccardosl1
 
Technology Trends in 2025: AI and Big Data Analytics
Technology Trends in 2025: AI and Big Data AnalyticsTechnology Trends in 2025: AI and Big Data Analytics
Technology Trends in 2025: AI and Big Data Analytics
InData Labs
 
Dev Dives: Automate and orchestrate your processes with UiPath Maestro
Dev Dives: Automate and orchestrate your processes with UiPath MaestroDev Dives: Automate and orchestrate your processes with UiPath Maestro
Dev Dives: Automate and orchestrate your processes with UiPath Maestro
UiPathCommunity
 
Automation Dreamin': Capture User Feedback From Anywhere
Automation Dreamin': Capture User Feedback From AnywhereAutomation Dreamin': Capture User Feedback From Anywhere
Automation Dreamin': Capture User Feedback From Anywhere
Lynda Kane
 
Complete Guide to Advanced Logistics Management Software in Riyadh.pdf
Complete Guide to Advanced Logistics Management Software in Riyadh.pdfComplete Guide to Advanced Logistics Management Software in Riyadh.pdf
Complete Guide to Advanced Logistics Management Software in Riyadh.pdf
Software Company
 
Network Security. Different aspects of Network Security.
Network Security. Different aspects of Network Security.Network Security. Different aspects of Network Security.
Network Security. Different aspects of Network Security.
gregtap1
 
Special Meetup Edition - TDX Bengaluru Meetup #52.pptx
Special Meetup Edition - TDX Bengaluru Meetup #52.pptxSpecial Meetup Edition - TDX Bengaluru Meetup #52.pptx
Special Meetup Edition - TDX Bengaluru Meetup #52.pptx
shyamraj55
 
Learn the Basics of Agile Development: Your Step-by-Step Guide
Learn the Basics of Agile Development: Your Step-by-Step GuideLearn the Basics of Agile Development: Your Step-by-Step Guide
Learn the Basics of Agile Development: Your Step-by-Step Guide
Marcel David
 
Drupalcamp Finland – Measuring Front-end Energy Consumption
Drupalcamp Finland – Measuring Front-end Energy ConsumptionDrupalcamp Finland – Measuring Front-end Energy Consumption
Drupalcamp Finland – Measuring Front-end Energy Consumption
Exove
 
Leading AI Innovation As A Product Manager - Michael Jidael
Leading AI Innovation As A Product Manager - Michael JidaelLeading AI Innovation As A Product Manager - Michael Jidael
Leading AI Innovation As A Product Manager - Michael Jidael
Michael Jidael
 
2025-05-Q4-2024-Investor-Presentation.pptx
2025-05-Q4-2024-Investor-Presentation.pptx2025-05-Q4-2024-Investor-Presentation.pptx
2025-05-Q4-2024-Investor-Presentation.pptx
Samuele Fogagnolo
 
Linux Professional Institute LPIC-1 Exam.pdf
Linux Professional Institute LPIC-1 Exam.pdfLinux Professional Institute LPIC-1 Exam.pdf
Linux Professional Institute LPIC-1 Exam.pdf
RHCSA Guru
 
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptxDevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
Justin Reock
 
Electronic_Mail_Attacks-1-35.pdf by xploit
Electronic_Mail_Attacks-1-35.pdf by xploitElectronic_Mail_Attacks-1-35.pdf by xploit
Electronic_Mail_Attacks-1-35.pdf by xploit
niftliyevhuseyn
 
Automation Hour 1/28/2022: Capture User Feedback from Anywhere
Automation Hour 1/28/2022: Capture User Feedback from AnywhereAutomation Hour 1/28/2022: Capture User Feedback from Anywhere
Automation Hour 1/28/2022: Capture User Feedback from Anywhere
Lynda Kane
 
"PHP and MySQL CRUD Operations for Student Management System"
"PHP and MySQL CRUD Operations for Student Management System""PHP and MySQL CRUD Operations for Student Management System"
"PHP and MySQL CRUD Operations for Student Management System"
Jainul Musani
 
Into The Box Conference Keynote Day 1 (ITB2025)
Into The Box Conference Keynote Day 1 (ITB2025)Into The Box Conference Keynote Day 1 (ITB2025)
Into The Box Conference Keynote Day 1 (ITB2025)
Ortus Solutions, Corp
 
tecnologias de las primeras civilizaciones.pdf
tecnologias de las primeras civilizaciones.pdftecnologias de las primeras civilizaciones.pdf
tecnologias de las primeras civilizaciones.pdf
fjgm517
 
Build Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For DevsBuild Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For Devs
Brian McKeiver
 
Image processinglab image processing image processing
Image processinglab image processing  image processingImage processinglab image processing  image processing
Image processinglab image processing image processing
RaghadHany
 
Cyber Awareness overview for 2025 month of security
Cyber Awareness overview for 2025 month of securityCyber Awareness overview for 2025 month of security
Cyber Awareness overview for 2025 month of security
riccardosl1
 
Technology Trends in 2025: AI and Big Data Analytics
Technology Trends in 2025: AI and Big Data AnalyticsTechnology Trends in 2025: AI and Big Data Analytics
Technology Trends in 2025: AI and Big Data Analytics
InData Labs
 
Dev Dives: Automate and orchestrate your processes with UiPath Maestro
Dev Dives: Automate and orchestrate your processes with UiPath MaestroDev Dives: Automate and orchestrate your processes with UiPath Maestro
Dev Dives: Automate and orchestrate your processes with UiPath Maestro
UiPathCommunity
 
Automation Dreamin': Capture User Feedback From Anywhere
Automation Dreamin': Capture User Feedback From AnywhereAutomation Dreamin': Capture User Feedback From Anywhere
Automation Dreamin': Capture User Feedback From Anywhere
Lynda Kane
 
Complete Guide to Advanced Logistics Management Software in Riyadh.pdf
Complete Guide to Advanced Logistics Management Software in Riyadh.pdfComplete Guide to Advanced Logistics Management Software in Riyadh.pdf
Complete Guide to Advanced Logistics Management Software in Riyadh.pdf
Software Company
 
Network Security. Different aspects of Network Security.
Network Security. Different aspects of Network Security.Network Security. Different aspects of Network Security.
Network Security. Different aspects of Network Security.
gregtap1
 
Special Meetup Edition - TDX Bengaluru Meetup #52.pptx
Special Meetup Edition - TDX Bengaluru Meetup #52.pptxSpecial Meetup Edition - TDX Bengaluru Meetup #52.pptx
Special Meetup Edition - TDX Bengaluru Meetup #52.pptx
shyamraj55
 
Learn the Basics of Agile Development: Your Step-by-Step Guide
Learn the Basics of Agile Development: Your Step-by-Step GuideLearn the Basics of Agile Development: Your Step-by-Step Guide
Learn the Basics of Agile Development: Your Step-by-Step Guide
Marcel David
 
Drupalcamp Finland – Measuring Front-end Energy Consumption
Drupalcamp Finland – Measuring Front-end Energy ConsumptionDrupalcamp Finland – Measuring Front-end Energy Consumption
Drupalcamp Finland – Measuring Front-end Energy Consumption
Exove
 
Leading AI Innovation As A Product Manager - Michael Jidael
Leading AI Innovation As A Product Manager - Michael JidaelLeading AI Innovation As A Product Manager - Michael Jidael
Leading AI Innovation As A Product Manager - Michael Jidael
Michael Jidael
 
2025-05-Q4-2024-Investor-Presentation.pptx
2025-05-Q4-2024-Investor-Presentation.pptx2025-05-Q4-2024-Investor-Presentation.pptx
2025-05-Q4-2024-Investor-Presentation.pptx
Samuele Fogagnolo
 
Linux Professional Institute LPIC-1 Exam.pdf
Linux Professional Institute LPIC-1 Exam.pdfLinux Professional Institute LPIC-1 Exam.pdf
Linux Professional Institute LPIC-1 Exam.pdf
RHCSA Guru
 
Ad

Version Control Systems with git (and github) as an example

  • 1. 03/18/16 NOS Conf 2016 Version control system with git and (github) as an example Gaurav Garg @gaurav_garg_ [email protected] freenode irc nic: ggarg
  • 2. 03/18/16 NOS Conf 2016 Agenda  VCS – What is it ?  Why using a VCS is good idea  Git Basic including: ➢How to obtain and install Git ➢How to use it for basic/common operation ➢More information resource for Git  Q & A
  • 3. 03/18/16 NOS Conf 2016 VCS What is it ? • A way to keep track of changes to files or folders • Keep record of changes why, what, when • Non distributed system (subversion, CVS) server has the master repo, all commit goes to the server • Distributed (Git, mercurial) server has the master repo, but you have copy of that repo (clone) in your machine
  • 4. 03/18/16 NOS Conf 2016 Getting Git •Dependencies: * on a system that has yum (such as fedora) $ yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel * on a system that has apt-get (debian based system) $ apt-get install libcurl4-gnutls-dev libexpat1-dev gettext libz-dev libssl-dev
  • 5. 03/18/16 NOS Conf 2016 Getting Git cont... •Get the latest snapshot from git website: http://git-scm.com/download Then, compile and install: $ tar -zxf git-1.7.2.2.tar.gz $ cd git-1.7.2.2 $ make prefix=/usr/local all $ sudo make prefix=/usr/local install
  • 6. 03/18/16 NOS Conf 2016 Getting Git cont... • Binary Installer: If you want to directly install binary then:  For Fedora: $ yum install git  For debina based distribution: $ apt-get install git  For mac $ brew install git
  • 7. 03/18/16 NOS Conf 2016 Git basic operation •Checking the installation: Check if Git is installed $ git - -version git version 1.9.3 If not then follow the installation steps that mentioned in previous slides. • Setting user name and email to your git config: $ git config --global user.name "Gaurav Kumar Garg" $ git config --global user.email " [email protected]" Note: If you want to set it for specific repositery then cd to that repositery and Remove “--global” option. $ git config - -list command will verify user name and email address
  • 8. 03/18/16 NOS Conf 2016 Git basic operation cont... • Obtaining a repository: Creating a repository (if it does not exist remotely) $ git init (follow http://git-scm.com/docs/git-init for more information) Or cloning a remote repository: git clone ssh://[username@]git.gluster.org/glusterfs.git glusterfs For eg: cloning a gluserfs repository: git clone ssh://[email protected]/glusterfs.git glusterfs here glusterfs is optional, which will be the name of repository. Inspecting a repo: $ vim .git/config
  • 9. 03/18/16 NOS Conf 2016 Git basic operation cont... • Inspecting repo: $ git tag will show you list of all tags (versioning of software) $ git status Difference b/w index file and current head commit $ git log Sow list of all commit with commit message $ git log -1 Show top 1st commit $ git log - -pretty=oneline Show list of all commit in single line
  • 10. 03/18/16 NOS Conf 2016 Git basic operation cont... • Making edit and commiting • Edit your file with your fav editor (vim/emac etc.) and save it. • $ git diff will show delta difference code of current master HEAD and current index • $ git status will show path of file as “Changes not staged for commit” • $ git add (-A) will show file as “Changes to be commited” • $ git commit -s write your commit message. Save and exit. * file changed, * insertion, * deletion (-) • Check your commit by $ git log
  • 11. 03/18/16 NOS Conf 2016 Git basic operation cont... • Recover your changes that you have added by mistakes $ git add <file name> file <file name> that you have added by mistake $ git status $ git reset HEAD <filename> $ git checkout - - <filename>
  • 12. 03/18/16 NOS Conf 2016 Git basic operation cont... • Best pratice is to make seperate branch $ git branch <branch name> or $ git checkout -b <branch name> $ git branch -D <branch name> will delete branch <branch name> $ git branch -m <branch name> <new name> will rename branch <branch name > with <new name>
  • 13. 03/18/16 NOS Conf 2016 Git basic operation cont... • Git Stashing Will allow you to save your changes without commiting them. • $ git stash save your change as a seperte stash@{*} branch with commit message • $ git stash list will show you list of all stash with commit message • $ git show <stash@{0}> will show you what code difference contain this this stash@{0} • $ git apply <stash@{0}> will allow to apply change in current branch.
  • 14. 03/18/16 NOS Conf 2016 Git basic operation cont... • Git rebase forward-port local commit to local upstream master • $ git rebase master * will update your local commit with master • $ git rebase -i HEAD~3 * will pick up top 3 commit and it * can be use for reword, edit, squash commit
  • 15. 03/18/16 NOS Conf 2016 Git basic operation cont... • Adding remote: • $ git remote add <remote name> <remote_url> Adding remote repo address in your local machine user can add multiple remote repo address • $ git remote -v will show you list of all remote address with name • $ git push <remote name> <branch name> will push <branch name> change to remote address
  • 16. 03/18/16 NOS Conf 2016 Git basic operation cont... • Git tagging • $ git tag * will list out all the tags (calles as versioning of software) • $ git tag -a <tag name> -m “tag description” * will give tag with tag name of tag version with current branch HEAD • $ git tag -d <tag name> * Delete tag <tag name>
  • 17. 03/18/16 NOS Conf 2016 More information resource for Git • $ git - -help for eg: git - -help <rebase> will give your help regarding “git rebase” • http://git-scm.com/docs/ contains resource of all git related command/operations.
  • 18. 03/18/16 NOS Conf 2016 Thank you....
  • 19. 03/18/16 NOS Conf 2016 Q/A