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

More Related Content

What's hot

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
GitGit
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
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 101615Brian 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
 

What's hot (20)

Git and GitHub workflows
Git and GitHub workflowsGit and GitHub workflows
Git and GitHub workflows
 
Git tutorial
Git tutorialGit tutorial
Git tutorial
 
Git commands
Git commandsGit commands
Git commands
 
Git basics
Git basicsGit basics
Git basics
 
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
 
Version Control with Git
Version Control with GitVersion Control with Git
Version Control with Git
 
Git tutorial
Git tutorial Git tutorial
Git tutorial
 
Git
GitGit
Git
 
Git presentation
Git presentationGit presentation
Git presentation
 
Git and fundamentals
Git and fundamentalsGit and fundamentals
Git and fundamentals
 
Advanced Git Tutorial
Advanced Git TutorialAdvanced Git Tutorial
Advanced Git Tutorial
 
01 - Git vs SVN
01 - Git vs SVN01 - Git vs SVN
01 - Git vs SVN
 
Advanced Git Presentation By Swawibe
Advanced Git Presentation By SwawibeAdvanced Git Presentation By Swawibe
Advanced Git Presentation By Swawibe
 
Extra bit with git
Extra bit with gitExtra bit with git
Extra bit with git
 
Git Tricks
Git TricksGit Tricks
Git Tricks
 
Git
GitGit
Git
 
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
 
Git vs svn
Git vs svnGit vs svn
Git vs svn
 
Extra bit with git
Extra bit with gitExtra bit with git
Extra bit with git
 
Git - Get Ready To Use It
Git - Get Ready To Use ItGit - Get Ready To Use It
Git - Get Ready To Use It
 

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

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
 
git-and-bitbucket
git-and-bitbucketgit-and-bitbucket
git-and-bitbucketazwildcat
 
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 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
 

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

390a gitintro 12au
390a gitintro 12au390a gitintro 12au
390a gitintro 12au
 
Understanding about git
Understanding about gitUnderstanding about git
Understanding about git
 
sample.pptx
sample.pptxsample.pptx
sample.pptx
 
Git and github 101
Git and github 101Git and github 101
Git and github 101
 
GitSetupLinux
GitSetupLinuxGitSetupLinux
GitSetupLinux
 
Git setuplinux
Git setuplinuxGit setuplinux
Git setuplinux
 
git-and-bitbucket
git-and-bitbucketgit-and-bitbucket
git-and-bitbucket
 
Getting some Git
Getting some GitGetting some Git
Getting some Git
 
GTFO: Git Theory For OpenSource
GTFO: Git Theory For OpenSourceGTFO: Git Theory For OpenSource
GTFO: Git Theory For OpenSource
 
Basic git
Basic gitBasic git
Basic git
 
Git
GitGit
Git
 
Git 入门与实践
Git 入门与实践Git 入门与实践
Git 入门与实践
 
Git 入门 与 实践
Git 入门 与 实践Git 入门 与 实践
Git 入门 与 实践
 
Git walkthrough
Git walkthroughGit walkthrough
Git walkthrough
 
Git session Dropsolid.com
Git session Dropsolid.comGit session Dropsolid.com
Git session Dropsolid.com
 
簡單介紹git
簡單介紹git簡單介紹git
簡單介紹git
 
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
 
Introduction to Git and Github
Introduction to Git and Github Introduction to Git and Github
Introduction to Git and Github
 
Git and Github workshop GDSC MLRITM
Git and Github  workshop GDSC MLRITMGit and Github  workshop GDSC MLRITM
Git and Github workshop GDSC MLRITM
 
Exprimiendo GIT
Exprimiendo GITExprimiendo GIT
Exprimiendo GIT
 

Recently uploaded

The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
Jemma Hussein Allen
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
KatiaHIMEUR1
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
Kari Kakkonen
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
UiPathCommunity
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance
 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Tobias Schneck
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
Thijs Feryn
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
Elena Simperl
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
OnBoard
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
Paul Groth
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
91mobiles
 
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
Product School
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
ControlCase
 
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Product School
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
DanBrown980551
 
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Ramesh Iyer
 
Generating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using SmithyGenerating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using Smithy
g2nightmarescribd
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........
Alison B. Lowndes
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
Product School
 
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
Product School
 

Recently uploaded (20)

The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
 
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
 
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
 
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
 
Generating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using SmithyGenerating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using Smithy
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
 
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
 

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_ ggarg@redhat.com 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 " 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
  • 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://ggarg@git.gluster.org/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