SlideShare a Scribd company logo
Git	
  In	
  a	
  Nutshell	
  
By: Pranesh Vittal CG
http://in.linkedin.com/in/praneshvittal
Key	
  takeaways	
  from	
  this	
  session	
  
•  Differences	
  between	
  Centralized	
  &	
  Distributed	
  Version	
  
Control	
  System.	
  
•  Unlearning	
  some	
  of	
  the	
  concepts	
  from	
  CVS	
  /	
  SVN	
  World.	
  
•  What	
  is	
  Git?	
  
•  Git	
  IniEalizaEon	
  
•  Git	
  Config	
  /	
  Git	
  Ignore	
  
•  Most	
  Frequently	
  Used	
  Git	
  Commands	
  
•  Merging	
  Conflicts	
  
•  Git	
  Mergetool	
  
•  Git	
  Help	
  
•  Git	
  CollaboraEon	
  Methods	
  
•  What	
  is	
  a	
  PR	
  and	
  the	
  steps	
  associated	
  with	
  it?	
  
What	
  is	
  SCM	
  ???	
  
SCM	
  -­‐>	
  Source	
  Control	
  Management	
  
	
  
VCS	
  -­‐>	
  Version	
  Control	
  System	
  
	
  
Centralized	
  VCS	
  
•  CVS,	
  Perforce,	
  SVN	
  
	
  
Distributed	
  VCS	
  
•  Git,	
  Mercurial	
  
	
  
Unlearning	
  CVS	
  &	
  SVN	
  
git	
  equivalent	
  for	
  “svn	
  checkout	
  url”	
  is	
  “git	
  clone	
  url”	
  
git	
  equivalent	
  for	
  “svn	
  update”	
  is	
  “git	
  pull”	
  
git	
  equivalent	
  for	
  “svn	
  commit”	
  is	
  “git	
  commit	
  -­‐a	
  &&	
  git	
  
push”	
  
	
  
Some	
  of	
  the	
  features	
  available	
  in	
  Git:	
  
	
  
•  Cheap	
  &	
  Easy	
  Branching.	
  
•  Disconnected	
  Use	
  wherein	
  the	
  user	
  is	
  not	
  connected	
  to	
  
the	
  Network.	
  
•  Staging	
  just	
  what	
  is	
  required	
  for	
  a	
  parEcular	
  feature.	
  
•  BeYer	
  collaboraEon	
  with	
  other	
  developers.	
  
What	
  is	
  Git	
  ???	
  
•  Distributed	
  VCS	
  
•  Everything	
  is	
  check-­‐summed	
  (40	
  characters	
  sha-­‐1	
  hash.	
  Hexadecimal	
  unique	
  value	
  
calculated	
  based	
  on	
  author’s	
  name	
  &	
  email-­‐id,	
  contents	
  of	
  the	
  file	
  &	
  few	
  other	
  
parameters).	
  
•  Snapshots	
  and	
  not	
  differences.	
  
•  Everything	
  related	
  to	
  the	
  git	
  project	
  can	
  be	
  found	
  in	
  .git	
  directory	
  at	
  the	
  root	
  level	
  of	
  
the	
  project.	
  
	
  
	
  
What	
  is	
  Git	
  ???	
  
•  Nearly	
  Every	
  AcEon	
  Is	
  Local.	
  
•  Consists	
  of	
  following	
  areas:	
  
–  Working	
  Directory	
  
–  Staging	
  Area	
  
–  Git	
  Repository	
  
	
  
In	
  a	
  nut	
  shell	
  
Git	
  Config	
  
•  git	
  config	
  -­‐-­‐global	
  user.name	
  “Pranesh	
  ViYal”	
  
•  git	
  config	
  -­‐-­‐global	
  user.email	
  “me@email.com”	
  
	
  
OR	
  	
  
•  ~/.gitconfig	
  
[user]	
  
	
  name	
  =	
  Pranesh	
  ViYal	
  
	
  email	
  =	
  me@email.com	
  
[credenEal]	
  
	
  helper	
  =	
  cache	
  -­‐-­‐Emeout=3600	
  
[core]	
  
	
  editor	
  =	
  vim	
  
[merge]	
  
	
  tool	
  =	
  vimdiff	
  
[alias]	
  
	
  b	
  =	
  branch	
  
	
  
•  More	
  such	
  examples	
  :	
  
hYps://gist.github.com/pksunkara/988716	
  	
  
	
  
.giAgnore	
  
#	
  Compiled	
  source	
  #	
  
*.com	
  
*.class	
  
*.dll	
  
*.exe	
  
*.o#	
  Logs	
  and	
  databases	
  #	
  
*.log	
  
*.sql	
  
*.sqlite	
  
	
  	
  
#	
  OS	
  generated	
  files	
  #	
  
.DS_Store*	
  
ehthumbs.db	
  
Icon?	
  
Thumbs.db	
  
	
  
	
  	
  
*.so	
  
	
  	
  
#	
  Temporary	
  files	
  #	
  
*.swp	
  
*.swo	
  
*~	
  
	
  	
  
#	
  Packages	
  #	
  
*.7z	
  
*.dmg	
  
*.gz	
  
*.iso	
  
*.jar	
  
*.rar	
  
*.tar	
  
*.zip	
  
	
  	
  
	
  
https://github.com/sethvargo/chefspec/blob/master/.gitignore
Most	
  Frequently	
  Used	
  OperaAons	
  
init	
  
add	
  
branch	
  
commit	
  
checkout	
  
diff	
  
fetch	
  
log	
  
merge	
  
prune	
  
push	
  
pull	
  
rebase	
  
reset	
  
remote	
  
status	
  
stash	
  
show	
  
tag	
  
Most	
  Frequently	
  Used	
  Commands	
  
•  git	
  init	
  (Arer	
  creaEng	
  the	
  directory	
  and	
  cd	
  into	
  into	
  it).	
  
•  git	
  clone	
  <git-­‐repo>	
  
•  git	
  add	
  .	
  (Add	
  untracked	
  files)	
  
•  git	
  status	
  (Current	
  status	
  of	
  the	
  local	
  git	
  directory).	
  
•  git	
  commit	
  -­‐m	
  “First	
  Commit	
  of	
  the	
  file.”	
  (Commit	
  the	
  
files).	
  
•  git	
  push	
  <remote-­‐short-­‐name>	
  <branch-­‐name>	
  (Push	
  the	
  
changes	
  to	
  the	
  repository).	
  
•  git	
  log	
  (Log	
  of	
  checkins	
  performed	
  on	
  the	
  branch).	
  
•  git	
  log	
  -­‐p	
  -­‐2	
  (Details	
  of	
  the	
  last	
  2	
  commits).	
  
•  git	
  log	
  -­‐-­‐preYy=oneline	
  (Log	
  info	
  in	
  oneline	
  format).	
  
	
  
*remote-­‐short-­‐name	
  -­‐	
  default	
  value	
  is	
  origin	
  
	
  
Most	
  Frequently	
  Used	
  Commands	
  
•  git	
  diff	
  <old-­‐tag>	
  <new-­‐tag>	
  (Show	
  changes	
  between	
  commits,	
  
commit	
  and	
  working	
  tree	
  etc...)	
  
•  git	
  diff	
  -­‐-­‐cached	
  (Diff	
  between	
  the	
  working	
  and	
  the	
  staged	
  
area)	
  
•  git	
  diff	
  HEAD	
  (Diff	
  between	
  the	
  working	
  and	
  the	
  repository)	
  
•  git	
  rm	
  -­‐f	
  <filename>	
  (Delete	
  the	
  file	
  from	
  git).	
  
•  git	
  reset	
  HEAD	
  <file-­‐name>	
  (To	
  reset	
  a	
  file	
  that	
  has	
  been	
  
staged	
  but	
  not	
  checked-­‐in).	
  
•  git	
  checkout	
  <file-­‐name>	
  (To	
  reset	
  a	
  file	
  that	
  has	
  been	
  been	
  
modified	
  in	
  working	
  area).	
  
•  git	
  stash	
  (Temporary	
  check-­‐in	
  while	
  switching	
  between	
  
branches).	
  
•  git	
  stash	
  list	
  (List	
  of	
  stash	
  items).	
  
•  git	
  stash	
  apply	
  @stash@{n}	
  (Add	
  the	
  stashed	
  items	
  back	
  to	
  the	
  
branch).	
  
	
  
	
  
Most	
  Frequently	
  Used	
  Commands	
  
•  git	
  branch	
  (List	
  the	
  branches	
  on	
  the	
  local	
  repository.	
  Can	
  be	
  found	
  
in	
  .git/refs/heads/).	
  
•  git	
  branch	
  new-­‐branch	
  (Create	
  new	
  branch).	
  
•  git	
  checkout	
  new-­‐branch	
  (Switch	
  to	
  the	
  new	
  branch).	
  
•  git	
  checkout	
  -­‐b	
  <new-­‐branch>	
  <remote-­‐short-­‐name>/<branch-­‐
name>	
  (To	
  check	
  out	
  the	
  new	
  branch	
  from	
  the	
  repository).	
  	
  
•  git	
  diff	
  (Diff	
  of	
  the	
  current	
  state	
  with	
  the	
  repository).	
  
•  git	
  tag	
  <tag-­‐name>	
  (To	
  create	
  a	
  tag).	
  
•  git	
  checkout	
  -­‐-­‐track	
  <remote>/<branch>	
  
•  git	
  branch	
  -­‐r	
  (List	
  the	
  branches	
  on	
  the	
  remote	
  repository.	
  Can	
  be	
  
found	
  in	
  .git/refs/remotes/).	
  
•  git	
  branch	
  -­‐v	
  (List	
  out	
  the	
  recent	
  commits	
  performed	
  in	
  all	
  the	
  
branches)	
  
Most	
  Frequently	
  Used	
  Commands	
  
•  git	
  remote	
  (Display	
  list	
  of	
  remote	
  repositories).	
  
•  git	
  remote	
  add	
  <remote-­‐short-­‐name>	
  (To	
  create	
  a	
  remote	
  
repository).	
  
•  git	
  remote	
  fetch	
  <remote-­‐short-­‐name>	
  (To	
  fetch	
  the	
  changes	
  from	
  
other	
  repository.)	
  
•  git	
  fetch	
  <remote-­‐short-­‐name>	
  (To	
  get	
  files	
  from	
  remote	
  projects).	
  
•  git	
  pull	
  <remote-­‐short-­‐name>	
  <branch-­‐name>	
  (AutomaEcally	
  fetch	
  
and	
  then	
  merge	
  a	
  remote	
  branch	
  into	
  your	
  current	
  branch).	
  
•  git	
  merge	
  <branch-­‐to-­‐be-­‐merged>	
  (To	
  merge	
  the	
  changes.	
  Before	
  
execuEng	
  this,	
  make	
  sure	
  that	
  you	
  are	
  in	
  the	
  target	
  branch).	
  
•  git	
  rebase	
  <branch-­‐name>	
  (FuncEons	
  very	
  similar	
  to	
  merge,	
  but	
  good	
  
at	
  keeping	
  the	
  history	
  of	
  changes	
  in	
  a	
  clean	
  way.)	
  
•  git	
  branch	
  -­‐d	
  <branch-­‐name>	
  
•  git	
  reset	
  -­‐-­‐hard	
  HEAD	
  (When	
  SHIT	
  happens	
  and	
  you	
  messed	
  with	
  too	
  
many	
  merges	
  and	
  you	
  don’t	
  care	
  about	
  the	
  changes	
  you	
  did).	
  
	
  
Merging	
  Conflicts	
  
git	
  merge	
  <branch-­‐to-­‐be-­‐merged>	
  
Auto-­‐merging	
  index.html	
  
CONFLICT	
  (content):	
  Merge	
  conflict	
  in	
  index.html	
  
AutomaEc	
  merge	
  failed;	
  fix	
  conflicts	
  and	
  then	
  commit	
  the	
  result.	
  
	
  
git	
  status	
  
You	
  have	
  unmerged	
  paths.	
  
	
  
<<<<<<<	
  HEAD:index.html	
  
<div	
  id="footer">contact	
  :	
  email.support@github.com</div>	
  
=======	
  
<div	
  id="footer">	
  
	
  please	
  contact	
  us	
  at	
  support@github.com	
  
</div>	
  
>>>>>>>	
  iss53:index.html	
  
	
  
git	
  mergetool:	
  	
  
Git	
  mergetool	
  
Help	
  !!!	
  
git	
  help	
  <command>	
  
git	
  help	
  commit	
  
git	
  help	
  branch	
  
git	
  help	
  	
  
Git	
  Pull	
  Requests	
  
What	
  is	
  a	
  pull	
  request?	
  
	
  
Most	
  important	
  step	
  wherein	
  a	
  collaborator	
  
sends	
  across	
  his	
  changes	
  to	
  be	
  merged	
  into	
  
the	
  master	
  branch.	
  The	
  changes	
  will	
  be	
  pulled	
  
by	
  the	
  commiYer	
  and	
  merged	
  into	
  the	
  master.	
  
	
  
Popular	
  CollaboraAve	
  Development	
  Methods	
  
•  Fork	
  &	
  Pull	
  (Followed	
  in	
  most	
  of	
  the	
  open	
  
source	
  projects	
  on	
  GitHub).	
  
•  Shared	
  Repository	
  Model	
  (The	
  one	
  followed	
  
in	
  in	
  house	
  projects)	
  
Some	
  of	
  the	
  popular	
  models	
  
References	
  
hYp://nvie.com/posts/a-­‐successful-­‐git-­‐branching-­‐model/	
  	
  
hYp://scoYchacon.com/2011/08/31/github-­‐flow.html	
  	
  
hYp://git-­‐scm.com/doc	
  	
  
hYp://cleanercode.com/introducEon-­‐to-­‐git-­‐talk/introducEon-­‐to-­‐git.pdf	
  	
  
hYp://nvie.com/files/Git-­‐branching-­‐model.pdf	
  	
  
Q & A

More Related Content

What's hot

Git basic
Git basicGit basic
Git basic
Emran Ul Hadi
 
Git introduction workshop for scientists
Git introduction workshop for scientists Git introduction workshop for scientists
Git introduction workshop for scientists
Steven Hamblin
 
Gitting out of trouble
Gitting out of troubleGitting out of trouble
Gitting out of trouble
Jon Senchyna
 
Grokking opensource with github
Grokking opensource with githubGrokking opensource with github
Grokking opensource with github
GoogleDeveloperStude4
 
Git for beginners
Git for beginnersGit for beginners
Git for beginners
Arulmurugan Rajaraman
 
Git training v10
Git training v10Git training v10
Git training v10
Skander Hamza
 
Git tutorial
Git tutorialGit tutorial
Git tutorial
Elli Kanal
 
Git-ing out of your git messes
Git-ing out of  your git messesGit-ing out of  your git messes
Git-ing out of your git messes
Katie Sylor-Miller
 
Git Tutorial I
Git Tutorial IGit Tutorial I
Git Tutorial I
Jim Yeh
 
Git learning
Git learningGit learning
Git learning
Amit Gupta
 
Git commands
Git commandsGit commands
Git commands
Viyaan Jhiingade
 
Git Started With Git
Git Started With GitGit Started With Git
Git Started With Git
Nick Quaranto
 
Introduction to Git and Github
Introduction to Git and GithubIntroduction to Git and Github
Introduction to Git and Github
Roland Emmanuel Salunga
 
An Introduction to Git
An Introduction to GitAn Introduction to Git
An Introduction to Git
Hiroyuki Vincent Yamazaki
 
Git 101
Git 101Git 101
Git 101
Sachet Mittal
 
Basic principles of Git
Basic principles of GitBasic principles of Git
Basic principles of Git
phuongvohuy
 
Git - An Introduction
Git - An IntroductionGit - An Introduction
Git - An Introduction
Behzad Altaf
 
Git 101 for Beginners
Git 101 for Beginners Git 101 for Beginners
Git 101 for Beginners
Anurag Upadhaya
 

What's hot (20)

Git basic
Git basicGit basic
Git basic
 
Git introduction workshop for scientists
Git introduction workshop for scientists Git introduction workshop for scientists
Git introduction workshop for scientists
 
Gitting out of trouble
Gitting out of troubleGitting out of trouble
Gitting out of trouble
 
Grokking opensource with github
Grokking opensource with githubGrokking opensource with github
Grokking opensource with github
 
Git for beginners
Git for beginnersGit for beginners
Git for beginners
 
Git training v10
Git training v10Git training v10
Git training v10
 
Git tutorial
Git tutorialGit tutorial
Git tutorial
 
Git-ing out of your git messes
Git-ing out of  your git messesGit-ing out of  your git messes
Git-ing out of your git messes
 
Git Tutorial I
Git Tutorial IGit Tutorial I
Git Tutorial I
 
Git learning
Git learningGit learning
Git learning
 
Git commands
Git commandsGit commands
Git commands
 
Git real slides
Git real slidesGit real slides
Git real slides
 
Git Started With Git
Git Started With GitGit Started With Git
Git Started With Git
 
Introduction To Git
Introduction To GitIntroduction To Git
Introduction To Git
 
Introduction to Git and Github
Introduction to Git and GithubIntroduction to Git and Github
Introduction to Git and Github
 
An Introduction to Git
An Introduction to GitAn Introduction to Git
An Introduction to Git
 
Git 101
Git 101Git 101
Git 101
 
Basic principles of Git
Basic principles of GitBasic principles of Git
Basic principles of Git
 
Git - An Introduction
Git - An IntroductionGit - An Introduction
Git - An Introduction
 
Git 101 for Beginners
Git 101 for Beginners Git 101 for Beginners
Git 101 for Beginners
 

Similar to Git in a nutshell

An introduction to Git
An introduction to GitAn introduction to Git
An introduction to Git
Muhil Vannan
 
Introduction into Git
Introduction into GitIntroduction into Git
Introduction into Git
Serhii Kartashov
 
Introduction to Git and Github
Introduction to Git and Github Introduction to Git and Github
Introduction to Git and Github
Max Claus Nunes
 
Learning Basic GIT Cmd
Learning Basic GIT CmdLearning Basic GIT Cmd
Learning Basic GIT Cmd
srinathcox
 
Git Tech Talk
Git  Tech TalkGit  Tech Talk
Git Tech Talk
Chris Johnson
 
Git session Dropsolid.com
Git session Dropsolid.comGit session Dropsolid.com
Git session Dropsolid.com
dropsolid
 
Introduction To Git Workshop
Introduction To Git WorkshopIntroduction To Git Workshop
Introduction To Git Workshop
themystic_ca
 
Gitting the Most From Git
Gitting the Most From GitGitting the Most From Git
Gitting the Most From GitChris Miller
 
Introduction git
Introduction gitIntroduction git
Introduction git
Dian Sigit Prastowo
 
Beginner's Guide to Version Control with Git
Beginner's Guide to Version Control with GitBeginner's Guide to Version Control with Git
Beginner's Guide to Version Control with GitRobert Lee-Cann
 
Git
Git Git
Demystifying Git
Demystifying GitDemystifying Git
Demystifying Git
Pablo Quiroga
 
Demystifying Git
Demystifying GitDemystifying Git
Demystifying Git
Pablo Quiroga
 
Git github
Git githubGit github
Git github
Anurag Deb
 
Git
GitGit
Git One Day Training Notes
Git One Day Training NotesGit One Day Training Notes
Git One Day Training Notes
glen_a_smith
 
Embedded Systems: Lecture 12: Introduction to Git & GitHub (Part 3)
Embedded Systems: Lecture 12: Introduction to Git & GitHub (Part 3)Embedded Systems: Lecture 12: Introduction to Git & GitHub (Part 3)
Embedded Systems: Lecture 12: Introduction to Git & GitHub (Part 3)
Ahmed El-Arabawy
 
Git and git workflow best practice
Git and git workflow best practiceGit and git workflow best practice
Git and git workflow best practice
Majid Hosseini
 
Git and Github workshop GDSC MLRITM
Git and Github  workshop GDSC MLRITMGit and Github  workshop GDSC MLRITM
Git and Github workshop GDSC MLRITM
gdsc13
 
Git hub
Git hubGit hub
Git hub
Nitin Goel
 

Similar to Git in a nutshell (20)

An introduction to Git
An introduction to GitAn introduction to Git
An introduction to Git
 
Introduction into Git
Introduction into GitIntroduction into Git
Introduction into Git
 
Introduction to Git and Github
Introduction to Git and Github Introduction to Git and Github
Introduction to Git and Github
 
Learning Basic GIT Cmd
Learning Basic GIT CmdLearning Basic GIT Cmd
Learning Basic GIT Cmd
 
Git Tech Talk
Git  Tech TalkGit  Tech Talk
Git Tech Talk
 
Git session Dropsolid.com
Git session Dropsolid.comGit session Dropsolid.com
Git session Dropsolid.com
 
Introduction To Git Workshop
Introduction To Git WorkshopIntroduction To Git Workshop
Introduction To Git Workshop
 
Gitting the Most From Git
Gitting the Most From GitGitting the Most From Git
Gitting the Most From Git
 
Introduction git
Introduction gitIntroduction git
Introduction git
 
Beginner's Guide to Version Control with Git
Beginner's Guide to Version Control with GitBeginner's Guide to Version Control with Git
Beginner's Guide to Version Control with Git
 
Git
Git Git
Git
 
Demystifying Git
Demystifying GitDemystifying Git
Demystifying Git
 
Demystifying Git
Demystifying GitDemystifying Git
Demystifying Git
 
Git github
Git githubGit github
Git github
 
Git
GitGit
Git
 
Git One Day Training Notes
Git One Day Training NotesGit One Day Training Notes
Git One Day Training Notes
 
Embedded Systems: Lecture 12: Introduction to Git & GitHub (Part 3)
Embedded Systems: Lecture 12: Introduction to Git & GitHub (Part 3)Embedded Systems: Lecture 12: Introduction to Git & GitHub (Part 3)
Embedded Systems: Lecture 12: Introduction to Git & GitHub (Part 3)
 
Git and git workflow best practice
Git and git workflow best practiceGit and git workflow best practice
Git and git workflow best practice
 
Git and Github workshop GDSC MLRITM
Git and Github  workshop GDSC MLRITMGit and Github  workshop GDSC MLRITM
Git and Github workshop GDSC MLRITM
 
Git hub
Git hubGit hub
Git hub
 

Recently uploaded

BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024
Ortus Solutions, Corp
 
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
Łukasz Chruściel
 
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Łukasz Chruściel
 
Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus
 
Vitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdfVitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke
 
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Globus
 
Enterprise Software Development with No Code Solutions.pptx
Enterprise Software Development with No Code Solutions.pptxEnterprise Software Development with No Code Solutions.pptx
Enterprise Software Development with No Code Solutions.pptx
QuickwayInfoSystems3
 
OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024
OpenMetadata
 
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI AppAI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
Google
 
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing SuiteAI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
Google
 
Pro Unity Game Development with C-sharp Book
Pro Unity Game Development with C-sharp BookPro Unity Game Development with C-sharp Book
Pro Unity Game Development with C-sharp Book
abdulrafaychaudhry
 
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOMLORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
lorraineandreiamcidl
 
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data AnalysisProviding Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
Globus
 
Mobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona InfotechMobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona Infotech
Drona Infotech
 
Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604
Fermin Galan
 
Game Development with Unity3D (Game Development lecture 3)
Game Development  with Unity3D (Game Development lecture 3)Game Development  with Unity3D (Game Development lecture 3)
Game Development with Unity3D (Game Development lecture 3)
abdulrafaychaudhry
 
A Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of PassageA Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of Passage
Philip Schwarz
 
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
Juraj Vysvader
 
Atelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissancesAtelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissances
Neo4j
 
E-commerce Application Development Company.pdf
E-commerce Application Development Company.pdfE-commerce Application Development Company.pdf
E-commerce Application Development Company.pdf
Hornet Dynamics
 

Recently uploaded (20)

BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024
 
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
 
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
 
Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024
 
Vitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdfVitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdf
 
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
 
Enterprise Software Development with No Code Solutions.pptx
Enterprise Software Development with No Code Solutions.pptxEnterprise Software Development with No Code Solutions.pptx
Enterprise Software Development with No Code Solutions.pptx
 
OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024
 
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI AppAI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
 
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing SuiteAI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
 
Pro Unity Game Development with C-sharp Book
Pro Unity Game Development with C-sharp BookPro Unity Game Development with C-sharp Book
Pro Unity Game Development with C-sharp Book
 
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOMLORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
 
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data AnalysisProviding Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
 
Mobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona InfotechMobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona Infotech
 
Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604
 
Game Development with Unity3D (Game Development lecture 3)
Game Development  with Unity3D (Game Development lecture 3)Game Development  with Unity3D (Game Development lecture 3)
Game Development with Unity3D (Game Development lecture 3)
 
A Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of PassageA Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of Passage
 
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
 
Atelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissancesAtelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissances
 
E-commerce Application Development Company.pdf
E-commerce Application Development Company.pdfE-commerce Application Development Company.pdf
E-commerce Application Development Company.pdf
 

Git in a nutshell

  • 1. Git  In  a  Nutshell   By: Pranesh Vittal CG http://in.linkedin.com/in/praneshvittal
  • 2. Key  takeaways  from  this  session   •  Differences  between  Centralized  &  Distributed  Version   Control  System.   •  Unlearning  some  of  the  concepts  from  CVS  /  SVN  World.   •  What  is  Git?   •  Git  IniEalizaEon   •  Git  Config  /  Git  Ignore   •  Most  Frequently  Used  Git  Commands   •  Merging  Conflicts   •  Git  Mergetool   •  Git  Help   •  Git  CollaboraEon  Methods   •  What  is  a  PR  and  the  steps  associated  with  it?  
  • 3. What  is  SCM  ???   SCM  -­‐>  Source  Control  Management     VCS  -­‐>  Version  Control  System     Centralized  VCS   •  CVS,  Perforce,  SVN     Distributed  VCS   •  Git,  Mercurial    
  • 4. Unlearning  CVS  &  SVN   git  equivalent  for  “svn  checkout  url”  is  “git  clone  url”   git  equivalent  for  “svn  update”  is  “git  pull”   git  equivalent  for  “svn  commit”  is  “git  commit  -­‐a  &&  git   push”     Some  of  the  features  available  in  Git:     •  Cheap  &  Easy  Branching.   •  Disconnected  Use  wherein  the  user  is  not  connected  to   the  Network.   •  Staging  just  what  is  required  for  a  parEcular  feature.   •  BeYer  collaboraEon  with  other  developers.  
  • 5. What  is  Git  ???   •  Distributed  VCS   •  Everything  is  check-­‐summed  (40  characters  sha-­‐1  hash.  Hexadecimal  unique  value   calculated  based  on  author’s  name  &  email-­‐id,  contents  of  the  file  &  few  other   parameters).   •  Snapshots  and  not  differences.   •  Everything  related  to  the  git  project  can  be  found  in  .git  directory  at  the  root  level  of   the  project.      
  • 6. What  is  Git  ???   •  Nearly  Every  AcEon  Is  Local.   •  Consists  of  following  areas:   –  Working  Directory   –  Staging  Area   –  Git  Repository    
  • 7. In  a  nut  shell  
  • 8. Git  Config   •  git  config  -­‐-­‐global  user.name  “Pranesh  ViYal”   •  git  config  -­‐-­‐global  user.email  “me@email.com”     OR     •  ~/.gitconfig   [user]    name  =  Pranesh  ViYal    email  =  me@email.com   [credenEal]    helper  =  cache  -­‐-­‐Emeout=3600   [core]    editor  =  vim   [merge]    tool  =  vimdiff   [alias]    b  =  branch     •  More  such  examples  :   hYps://gist.github.com/pksunkara/988716      
  • 9. .giAgnore   #  Compiled  source  #   *.com   *.class   *.dll   *.exe   *.o#  Logs  and  databases  #   *.log   *.sql   *.sqlite       #  OS  generated  files  #   .DS_Store*   ehthumbs.db   Icon?   Thumbs.db         *.so       #  Temporary  files  #   *.swp   *.swo   *~       #  Packages  #   *.7z   *.dmg   *.gz   *.iso   *.jar   *.rar   *.tar   *.zip         https://github.com/sethvargo/chefspec/blob/master/.gitignore
  • 10. Most  Frequently  Used  OperaAons   init   add   branch   commit   checkout   diff   fetch   log   merge   prune   push   pull   rebase   reset   remote   status   stash   show   tag  
  • 11. Most  Frequently  Used  Commands   •  git  init  (Arer  creaEng  the  directory  and  cd  into  into  it).   •  git  clone  <git-­‐repo>   •  git  add  .  (Add  untracked  files)   •  git  status  (Current  status  of  the  local  git  directory).   •  git  commit  -­‐m  “First  Commit  of  the  file.”  (Commit  the   files).   •  git  push  <remote-­‐short-­‐name>  <branch-­‐name>  (Push  the   changes  to  the  repository).   •  git  log  (Log  of  checkins  performed  on  the  branch).   •  git  log  -­‐p  -­‐2  (Details  of  the  last  2  commits).   •  git  log  -­‐-­‐preYy=oneline  (Log  info  in  oneline  format).     *remote-­‐short-­‐name  -­‐  default  value  is  origin    
  • 12. Most  Frequently  Used  Commands   •  git  diff  <old-­‐tag>  <new-­‐tag>  (Show  changes  between  commits,   commit  and  working  tree  etc...)   •  git  diff  -­‐-­‐cached  (Diff  between  the  working  and  the  staged   area)   •  git  diff  HEAD  (Diff  between  the  working  and  the  repository)   •  git  rm  -­‐f  <filename>  (Delete  the  file  from  git).   •  git  reset  HEAD  <file-­‐name>  (To  reset  a  file  that  has  been   staged  but  not  checked-­‐in).   •  git  checkout  <file-­‐name>  (To  reset  a  file  that  has  been  been   modified  in  working  area).   •  git  stash  (Temporary  check-­‐in  while  switching  between   branches).   •  git  stash  list  (List  of  stash  items).   •  git  stash  apply  @stash@{n}  (Add  the  stashed  items  back  to  the   branch).      
  • 13. Most  Frequently  Used  Commands   •  git  branch  (List  the  branches  on  the  local  repository.  Can  be  found   in  .git/refs/heads/).   •  git  branch  new-­‐branch  (Create  new  branch).   •  git  checkout  new-­‐branch  (Switch  to  the  new  branch).   •  git  checkout  -­‐b  <new-­‐branch>  <remote-­‐short-­‐name>/<branch-­‐ name>  (To  check  out  the  new  branch  from  the  repository).     •  git  diff  (Diff  of  the  current  state  with  the  repository).   •  git  tag  <tag-­‐name>  (To  create  a  tag).   •  git  checkout  -­‐-­‐track  <remote>/<branch>   •  git  branch  -­‐r  (List  the  branches  on  the  remote  repository.  Can  be   found  in  .git/refs/remotes/).   •  git  branch  -­‐v  (List  out  the  recent  commits  performed  in  all  the   branches)  
  • 14. Most  Frequently  Used  Commands   •  git  remote  (Display  list  of  remote  repositories).   •  git  remote  add  <remote-­‐short-­‐name>  (To  create  a  remote   repository).   •  git  remote  fetch  <remote-­‐short-­‐name>  (To  fetch  the  changes  from   other  repository.)   •  git  fetch  <remote-­‐short-­‐name>  (To  get  files  from  remote  projects).   •  git  pull  <remote-­‐short-­‐name>  <branch-­‐name>  (AutomaEcally  fetch   and  then  merge  a  remote  branch  into  your  current  branch).   •  git  merge  <branch-­‐to-­‐be-­‐merged>  (To  merge  the  changes.  Before   execuEng  this,  make  sure  that  you  are  in  the  target  branch).   •  git  rebase  <branch-­‐name>  (FuncEons  very  similar  to  merge,  but  good   at  keeping  the  history  of  changes  in  a  clean  way.)   •  git  branch  -­‐d  <branch-­‐name>   •  git  reset  -­‐-­‐hard  HEAD  (When  SHIT  happens  and  you  messed  with  too   many  merges  and  you  don’t  care  about  the  changes  you  did).    
  • 15. Merging  Conflicts   git  merge  <branch-­‐to-­‐be-­‐merged>   Auto-­‐merging  index.html   CONFLICT  (content):  Merge  conflict  in  index.html   AutomaEc  merge  failed;  fix  conflicts  and  then  commit  the  result.     git  status   You  have  unmerged  paths.     <<<<<<<  HEAD:index.html   <div  id="footer">contact  :  email.support@github.com</div>   =======   <div  id="footer">    please  contact  us  at  support@github.com   </div>   >>>>>>>  iss53:index.html     git  mergetool:    
  • 17. Help  !!!   git  help  <command>   git  help  commit   git  help  branch   git  help    
  • 18. Git  Pull  Requests   What  is  a  pull  request?     Most  important  step  wherein  a  collaborator   sends  across  his  changes  to  be  merged  into   the  master  branch.  The  changes  will  be  pulled   by  the  commiYer  and  merged  into  the  master.    
  • 19. Popular  CollaboraAve  Development  Methods   •  Fork  &  Pull  (Followed  in  most  of  the  open   source  projects  on  GitHub).   •  Shared  Repository  Model  (The  one  followed   in  in  house  projects)  
  • 20. Some  of  the  popular  models  
  • 21. References   hYp://nvie.com/posts/a-­‐successful-­‐git-­‐branching-­‐model/     hYp://scoYchacon.com/2011/08/31/github-­‐flow.html     hYp://git-­‐scm.com/doc     hYp://cleanercode.com/introducEon-­‐to-­‐git-­‐talk/introducEon-­‐to-­‐git.pdf     hYp://nvie.com/files/Git-­‐branching-­‐model.pdf    
  • 22. Q & A