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
Ad

More Related Content

What's hot (20)

Threads in python
Threads in pythonThreads in python
Threads in python
baabtra.com - No. 1 supplier of quality freshers
 
Railway Oriented Programming
Railway Oriented ProgrammingRailway Oriented Programming
Railway Oriented Programming
Scott Wlaschin
 
constexpr関数はコンパイル時処理。これはいい。実行時が霞んで見える。cpuの嬌声が聞こえてきそうだ
constexpr関数はコンパイル時処理。これはいい。実行時が霞んで見える。cpuの嬌声が聞こえてきそうだconstexpr関数はコンパイル時処理。これはいい。実行時が霞んで見える。cpuの嬌声が聞こえてきそうだ
constexpr関数はコンパイル時処理。これはいい。実行時が霞んで見える。cpuの嬌声が聞こえてきそうだ
Genya Murakami
 
Domain Driven Design with the F# type System -- F#unctional Londoners 2014
Domain Driven Design with the F# type System -- F#unctional Londoners 2014Domain Driven Design with the F# type System -- F#unctional Londoners 2014
Domain Driven Design with the F# type System -- F#unctional Londoners 2014
Scott Wlaschin
 
Reinventing the Transaction Script (NDC London 2020)
Reinventing the Transaction Script (NDC London 2020)Reinventing the Transaction Script (NDC London 2020)
Reinventing the Transaction Script (NDC London 2020)
Scott Wlaschin
 
Rpn and forth 超入門
Rpn and forth 超入門Rpn and forth 超入門
Rpn and forth 超入門
Yoshitaka Seo
 
Managing console input and output
Managing console input and outputManaging console input and output
Managing console input and output
gourav kottawar
 
Android jetpack compose | Declarative UI
Android jetpack compose | Declarative UI Android jetpack compose | Declarative UI
Android jetpack compose | Declarative UI
Ajinkya Saswade
 
Function overloading and overriding
Function overloading and overridingFunction overloading and overriding
Function overloading and overriding
Rajab Ali
 
Linux Lab Manual.doc
Linux Lab Manual.docLinux Lab Manual.doc
Linux Lab Manual.doc
Dr.M.Karthika parthasarathy
 
Do we need Unsafe in Java?
Do we need Unsafe in Java?Do we need Unsafe in Java?
Do we need Unsafe in Java?
Andrei Pangin
 
Git commands
Git commandsGit commands
Git commands
Viyaan Jhiingade
 
git and github
git and githubgit and github
git and github
Darren Oakley
 
The everyday developer's guide to version control with Git
The everyday developer's guide to version control with GitThe everyday developer's guide to version control with Git
The everyday developer's guide to version control with Git
E Carter
 
Java 8 Lambda Expressions
Java 8 Lambda ExpressionsJava 8 Lambda Expressions
Java 8 Lambda Expressions
Scott Leberknight
 
Git
GitGit
Git
Mouad EL Fakir
 
TypeScript: Basic Features and Compilation Guide
TypeScript: Basic Features and Compilation GuideTypeScript: Basic Features and Compilation Guide
TypeScript: Basic Features and Compilation Guide
Nascenia IT
 
Yacc lex
Yacc lexYacc lex
Yacc lex
915086731
 
Python cgi programming
Python cgi programmingPython cgi programming
Python cgi programming
Smt. Indira Gandhi College of Engineering, Navi Mumbai, Mumbai
 
Classes and objects1
Classes and objects1Classes and objects1
Classes and objects1
Vineeta Garg
 
Railway Oriented Programming
Railway Oriented ProgrammingRailway Oriented Programming
Railway Oriented Programming
Scott Wlaschin
 
constexpr関数はコンパイル時処理。これはいい。実行時が霞んで見える。cpuの嬌声が聞こえてきそうだ
constexpr関数はコンパイル時処理。これはいい。実行時が霞んで見える。cpuの嬌声が聞こえてきそうだconstexpr関数はコンパイル時処理。これはいい。実行時が霞んで見える。cpuの嬌声が聞こえてきそうだ
constexpr関数はコンパイル時処理。これはいい。実行時が霞んで見える。cpuの嬌声が聞こえてきそうだ
Genya Murakami
 
Domain Driven Design with the F# type System -- F#unctional Londoners 2014
Domain Driven Design with the F# type System -- F#unctional Londoners 2014Domain Driven Design with the F# type System -- F#unctional Londoners 2014
Domain Driven Design with the F# type System -- F#unctional Londoners 2014
Scott Wlaschin
 
Reinventing the Transaction Script (NDC London 2020)
Reinventing the Transaction Script (NDC London 2020)Reinventing the Transaction Script (NDC London 2020)
Reinventing the Transaction Script (NDC London 2020)
Scott Wlaschin
 
Rpn and forth 超入門
Rpn and forth 超入門Rpn and forth 超入門
Rpn and forth 超入門
Yoshitaka Seo
 
Managing console input and output
Managing console input and outputManaging console input and output
Managing console input and output
gourav kottawar
 
Android jetpack compose | Declarative UI
Android jetpack compose | Declarative UI Android jetpack compose | Declarative UI
Android jetpack compose | Declarative UI
Ajinkya Saswade
 
Function overloading and overriding
Function overloading and overridingFunction overloading and overriding
Function overloading and overriding
Rajab Ali
 
Do we need Unsafe in Java?
Do we need Unsafe in Java?Do we need Unsafe in Java?
Do we need Unsafe in Java?
Andrei Pangin
 
The everyday developer's guide to version control with Git
The everyday developer's guide to version control with GitThe everyday developer's guide to version control with Git
The everyday developer's guide to version control with Git
E Carter
 
TypeScript: Basic Features and Compilation Guide
TypeScript: Basic Features and Compilation GuideTypeScript: Basic Features and Compilation Guide
TypeScript: Basic Features and Compilation Guide
Nascenia IT
 
Classes and objects1
Classes and objects1Classes and objects1
Classes and objects1
Vineeta Garg
 

Similar to Git in a nutshell (20)

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
 
Git training v10
Git training v10Git training v10
Git training v10
Skander Hamza
 
Learning Basic GIT Cmd
Learning Basic GIT CmdLearning Basic GIT Cmd
Learning Basic GIT Cmd
srinathcox
 
Git basic
Git basicGit basic
Git basic
Emran Ul Hadi
 
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 Git
Chris Miller
 
Introduction git
Introduction gitIntroduction git
Introduction git
Dian Sigit Prastowo
 
Introduction to Git and Github
Introduction to Git and GithubIntroduction to Git and Github
Introduction to Git and Github
Roland Emmanuel Salunga
 
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
Robert Lee-Cann
 
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 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
 
An introduction to Git
An introduction to GitAn introduction to Git
An introduction to Git
Muhil Vannan
 
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 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 Git
Chris Miller
 
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
Robert Lee-Cann
 
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
 
Ad

Recently uploaded (20)

Maxon CINEMA 4D 2025 Crack FREE Download LINK
Maxon CINEMA 4D 2025 Crack FREE Download LINKMaxon CINEMA 4D 2025 Crack FREE Download LINK
Maxon CINEMA 4D 2025 Crack FREE Download LINK
younisnoman75
 
Adobe Lightroom Classic Crack FREE Latest link 2025
Adobe Lightroom Classic Crack FREE Latest link 2025Adobe Lightroom Classic Crack FREE Latest link 2025
Adobe Lightroom Classic Crack FREE Latest link 2025
kashifyounis067
 
Adobe Photoshop Lightroom CC 2025 Crack Latest Version
Adobe Photoshop Lightroom CC 2025 Crack Latest VersionAdobe Photoshop Lightroom CC 2025 Crack Latest Version
Adobe Photoshop Lightroom CC 2025 Crack Latest Version
usmanhidray
 
Get & Download Wondershare Filmora Crack Latest [2025]
Get & Download Wondershare Filmora Crack Latest [2025]Get & Download Wondershare Filmora Crack Latest [2025]
Get & Download Wondershare Filmora Crack Latest [2025]
saniaaftab72555
 
Exceptional Behaviors: How Frequently Are They Tested? (AST 2025)
Exceptional Behaviors: How Frequently Are They Tested? (AST 2025)Exceptional Behaviors: How Frequently Are They Tested? (AST 2025)
Exceptional Behaviors: How Frequently Are They Tested? (AST 2025)
Andre Hora
 
Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...
Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...
Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...
Eric D. Schabell
 
Xforce Keygen 64-bit AutoCAD 2025 Crack
Xforce Keygen 64-bit AutoCAD 2025  CrackXforce Keygen 64-bit AutoCAD 2025  Crack
Xforce Keygen 64-bit AutoCAD 2025 Crack
usmanhidray
 
Top 10 Client Portal Software Solutions for 2025.docx
Top 10 Client Portal Software Solutions for 2025.docxTop 10 Client Portal Software Solutions for 2025.docx
Top 10 Client Portal Software Solutions for 2025.docx
Portli
 
Kubernetes_101_Zero_to_Platform_Engineer.pptx
Kubernetes_101_Zero_to_Platform_Engineer.pptxKubernetes_101_Zero_to_Platform_Engineer.pptx
Kubernetes_101_Zero_to_Platform_Engineer.pptx
CloudScouts
 
Designing AI-Powered APIs on Azure: Best Practices& Considerations
Designing AI-Powered APIs on Azure: Best Practices& ConsiderationsDesigning AI-Powered APIs on Azure: Best Practices& Considerations
Designing AI-Powered APIs on Azure: Best Practices& Considerations
Dinusha Kumarasiri
 
Landscape of Requirements Engineering for/by AI through Literature Review
Landscape of Requirements Engineering for/by AI through Literature ReviewLandscape of Requirements Engineering for/by AI through Literature Review
Landscape of Requirements Engineering for/by AI through Literature Review
Hironori Washizaki
 
Salesforce Data Cloud- Hyperscale data platform, built for Salesforce.
Salesforce Data Cloud- Hyperscale data platform, built for Salesforce.Salesforce Data Cloud- Hyperscale data platform, built for Salesforce.
Salesforce Data Cloud- Hyperscale data platform, built for Salesforce.
Dele Amefo
 
Salesforce Aged Complex Org Revitalization Process .pdf
Salesforce Aged Complex Org Revitalization Process .pdfSalesforce Aged Complex Org Revitalization Process .pdf
Salesforce Aged Complex Org Revitalization Process .pdf
SRINIVASARAO PUSULURI
 
Explaining GitHub Actions Failures with Large Language Models Challenges, In...
Explaining GitHub Actions Failures with Large Language Models Challenges, In...Explaining GitHub Actions Failures with Large Language Models Challenges, In...
Explaining GitHub Actions Failures with Large Language Models Challenges, In...
ssuserb14185
 
EASEUS Partition Master Crack + License Code
EASEUS Partition Master Crack + License CodeEASEUS Partition Master Crack + License Code
EASEUS Partition Master Crack + License Code
aneelaramzan63
 
How Valletta helped healthcare SaaS to transform QA and compliance to grow wi...
How Valletta helped healthcare SaaS to transform QA and compliance to grow wi...How Valletta helped healthcare SaaS to transform QA and compliance to grow wi...
How Valletta helped healthcare SaaS to transform QA and compliance to grow wi...
Egor Kaleynik
 
What Do Contribution Guidelines Say About Software Testing? (MSR 2025)
What Do Contribution Guidelines Say About Software Testing? (MSR 2025)What Do Contribution Guidelines Say About Software Testing? (MSR 2025)
What Do Contribution Guidelines Say About Software Testing? (MSR 2025)
Andre Hora
 
Adobe Photoshop CC 2025 Crack Full Serial Key With Latest
Adobe Photoshop CC 2025 Crack Full Serial Key  With LatestAdobe Photoshop CC 2025 Crack Full Serial Key  With Latest
Adobe Photoshop CC 2025 Crack Full Serial Key With Latest
usmanhidray
 
Adobe Master Collection CC Crack Advance Version 2025
Adobe Master Collection CC Crack Advance Version 2025Adobe Master Collection CC Crack Advance Version 2025
Adobe Master Collection CC Crack Advance Version 2025
kashifyounis067
 
Adobe Illustrator Crack FREE Download 2025 Latest Version
Adobe Illustrator Crack FREE Download 2025 Latest VersionAdobe Illustrator Crack FREE Download 2025 Latest Version
Adobe Illustrator Crack FREE Download 2025 Latest Version
kashifyounis067
 
Maxon CINEMA 4D 2025 Crack FREE Download LINK
Maxon CINEMA 4D 2025 Crack FREE Download LINKMaxon CINEMA 4D 2025 Crack FREE Download LINK
Maxon CINEMA 4D 2025 Crack FREE Download LINK
younisnoman75
 
Adobe Lightroom Classic Crack FREE Latest link 2025
Adobe Lightroom Classic Crack FREE Latest link 2025Adobe Lightroom Classic Crack FREE Latest link 2025
Adobe Lightroom Classic Crack FREE Latest link 2025
kashifyounis067
 
Adobe Photoshop Lightroom CC 2025 Crack Latest Version
Adobe Photoshop Lightroom CC 2025 Crack Latest VersionAdobe Photoshop Lightroom CC 2025 Crack Latest Version
Adobe Photoshop Lightroom CC 2025 Crack Latest Version
usmanhidray
 
Get & Download Wondershare Filmora Crack Latest [2025]
Get & Download Wondershare Filmora Crack Latest [2025]Get & Download Wondershare Filmora Crack Latest [2025]
Get & Download Wondershare Filmora Crack Latest [2025]
saniaaftab72555
 
Exceptional Behaviors: How Frequently Are They Tested? (AST 2025)
Exceptional Behaviors: How Frequently Are They Tested? (AST 2025)Exceptional Behaviors: How Frequently Are They Tested? (AST 2025)
Exceptional Behaviors: How Frequently Are They Tested? (AST 2025)
Andre Hora
 
Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...
Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...
Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...
Eric D. Schabell
 
Xforce Keygen 64-bit AutoCAD 2025 Crack
Xforce Keygen 64-bit AutoCAD 2025  CrackXforce Keygen 64-bit AutoCAD 2025  Crack
Xforce Keygen 64-bit AutoCAD 2025 Crack
usmanhidray
 
Top 10 Client Portal Software Solutions for 2025.docx
Top 10 Client Portal Software Solutions for 2025.docxTop 10 Client Portal Software Solutions for 2025.docx
Top 10 Client Portal Software Solutions for 2025.docx
Portli
 
Kubernetes_101_Zero_to_Platform_Engineer.pptx
Kubernetes_101_Zero_to_Platform_Engineer.pptxKubernetes_101_Zero_to_Platform_Engineer.pptx
Kubernetes_101_Zero_to_Platform_Engineer.pptx
CloudScouts
 
Designing AI-Powered APIs on Azure: Best Practices& Considerations
Designing AI-Powered APIs on Azure: Best Practices& ConsiderationsDesigning AI-Powered APIs on Azure: Best Practices& Considerations
Designing AI-Powered APIs on Azure: Best Practices& Considerations
Dinusha Kumarasiri
 
Landscape of Requirements Engineering for/by AI through Literature Review
Landscape of Requirements Engineering for/by AI through Literature ReviewLandscape of Requirements Engineering for/by AI through Literature Review
Landscape of Requirements Engineering for/by AI through Literature Review
Hironori Washizaki
 
Salesforce Data Cloud- Hyperscale data platform, built for Salesforce.
Salesforce Data Cloud- Hyperscale data platform, built for Salesforce.Salesforce Data Cloud- Hyperscale data platform, built for Salesforce.
Salesforce Data Cloud- Hyperscale data platform, built for Salesforce.
Dele Amefo
 
Salesforce Aged Complex Org Revitalization Process .pdf
Salesforce Aged Complex Org Revitalization Process .pdfSalesforce Aged Complex Org Revitalization Process .pdf
Salesforce Aged Complex Org Revitalization Process .pdf
SRINIVASARAO PUSULURI
 
Explaining GitHub Actions Failures with Large Language Models Challenges, In...
Explaining GitHub Actions Failures with Large Language Models Challenges, In...Explaining GitHub Actions Failures with Large Language Models Challenges, In...
Explaining GitHub Actions Failures with Large Language Models Challenges, In...
ssuserb14185
 
EASEUS Partition Master Crack + License Code
EASEUS Partition Master Crack + License CodeEASEUS Partition Master Crack + License Code
EASEUS Partition Master Crack + License Code
aneelaramzan63
 
How Valletta helped healthcare SaaS to transform QA and compliance to grow wi...
How Valletta helped healthcare SaaS to transform QA and compliance to grow wi...How Valletta helped healthcare SaaS to transform QA and compliance to grow wi...
How Valletta helped healthcare SaaS to transform QA and compliance to grow wi...
Egor Kaleynik
 
What Do Contribution Guidelines Say About Software Testing? (MSR 2025)
What Do Contribution Guidelines Say About Software Testing? (MSR 2025)What Do Contribution Guidelines Say About Software Testing? (MSR 2025)
What Do Contribution Guidelines Say About Software Testing? (MSR 2025)
Andre Hora
 
Adobe Photoshop CC 2025 Crack Full Serial Key With Latest
Adobe Photoshop CC 2025 Crack Full Serial Key  With LatestAdobe Photoshop CC 2025 Crack Full Serial Key  With Latest
Adobe Photoshop CC 2025 Crack Full Serial Key With Latest
usmanhidray
 
Adobe Master Collection CC Crack Advance Version 2025
Adobe Master Collection CC Crack Advance Version 2025Adobe Master Collection CC Crack Advance Version 2025
Adobe Master Collection CC Crack Advance Version 2025
kashifyounis067
 
Adobe Illustrator Crack FREE Download 2025 Latest Version
Adobe Illustrator Crack FREE Download 2025 Latest VersionAdobe Illustrator Crack FREE Download 2025 Latest Version
Adobe Illustrator Crack FREE Download 2025 Latest Version
kashifyounis067
 
Ad

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  “[email protected]”     OR     •  ~/.gitconfig   [user]    name  =  Pranesh  ViYal    email  =  [email protected]   [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 protected]</div>   =======   <div  id="footer">    please  contact  us  at  [email protected]   </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