SlideShare a Scribd company logo
1 of 7
Download to read offline
Internals Usage Distribution Merging and Rebasing Extras
Git for mere mortals
https://github.com/Kelsin/git-presentation
Christopher Giroir
July 26th, 2011
Christopher Giroir Git for mere mortals
Internals Usage Distribution Merging and Rebasing Extras
1 Internals
Objects
Branches and Tags
2 Usage
Creating and Commiting
Inspection
3 Distribution
Advantages
Architecture
Command Examples
4 Merging and Rebasing
Merging
Rebase
5 Extras
Remotes
Misc
Christopher Giroir Git for mere mortals
Internals Usage Distribution Merging and Rebasing Extras
Objects
Object Store
The git object store is a big black box and we like it that way.
It was written for speed and correctness
Comparisons
More information than CVS
More sane than SVN
More efficient than Mercurial
Christopher Giroir Git for mere mortals
Internals Usage Distribution Merging and Rebasing Extras
Objects
Blobs
_^]XYZ[Blob
Blobs store file data (text or binary).
Labeled by SHA1. If the content changes, so does the SHA.
Christopher Giroir Git for mere mortals
Internals Usage Distribution Merging and Rebasing Extras
Objects
Trees
_^]XYZ[Blob
_^]XYZ[Tree //
??
_^]XYZ[Blob
Trees point to blobs
Represent the entire state of the working directory
Also labeled by SHA’s.
Christopher Giroir Git for mere mortals
Internals Usage Distribution Merging and Rebasing Extras
Objects
Commits
onmlhijkCommit _^]XYZ[Blob
onmlhijkCommit
OO
//_^]XYZ[Tree
CC§§§§§§§§§§§§§
//_^]XYZ[Blob
Points to a tree object and parent commit(s)
Stores author and date information
Labeled by SHA’s.
Christopher Giroir Git for mere mortals
Internals Usage Distribution Merging and Rebasing Extras
Objects
Important Distinction!
Commits link to entires TREES not DIFFS.
Diffs are not stored in git, they are computed.
Christopher Giroir Git for mere mortals
Internals Usage Distribution Merging and Rebasing Extras
Branches and Tags
Pointers
Most other things in git are pointers to commits.
?>=<89:;a //
v3.0.1
?>=<89:;b //
bbbbbbbbb
Master
?=89:;c //?=89:;d //?=89:;e
SAVE-465
?=89:;g //
origin/SAVE-576
?=89:;h //?=89:;i
SAVE-576
Branches are just labels to commit SHA’s
Tags are just labels with meta information
Christopher Giroir Git for mere mortals
Internals Usage Distribution Merging and Rebasing Extras
Branches and Tags
Rewriting History
Rewriting a commit changes it’s SHA
Any commit after it changes as well
Most branch operations are quick and painless
Can shoot yourself in the foot and heal it back up again
Christopher Giroir Git for mere mortals
Internals Usage Distribution Merging and Rebasing Extras
Creating and Commiting
Starting Out
Setting User Info
git config --global user.name Christopher Giroir
git config --global user.email kelsin@valefor.com
Completely New Repo
cd dir-with-code
git init
Cloning any accessible repo
git clone git@github.com:Kelsin/configs.git
cd configs
Christopher Giroir Git for mere mortals
Internals Usage Distribution Merging and Rebasing Extras
Creating and Commiting
Commits
Initial Commit
git add .
git commit -m Initial Commit
Editing some files
git add edited-file.rb
git commit -m Improved everything
Adding to previous commit
git add edited-file.rb
git commit --amend
Christopher Giroir Git for mere mortals
Internals Usage Distribution Merging and Rebasing Extras
Inspection
Status and Diffs
Normal Status
git status
What’s current changed?
git diff
Changes from only one file
git diff example-file.rb
Changes between branches
git diff master
Christopher Giroir Git for mere mortals
Internals Usage Distribution Merging and Rebasing Extras
Inspection
Show and Log
Show current commit
git show
Show some other commit
git show 234ab32
Show log of recent commits
git log
Show pretty log
git log --graph --decorate --oneline
Christopher Giroir Git for mere mortals
Internals Usage Distribution Merging and Rebasing Extras
Inspection
Refs and Objects
By commit id
git show 234ab32
By branch
git show master
By tag
git show v3.0.2
Relative
git show HEAD^
Christopher Giroir Git for mere mortals
Internals Usage Distribution Merging and Rebasing Extras
Advantages
Distributed Source Control
Only difference from remote and local (normally): working
directories
Can function offline
Can “push” and “pull” from each other, as well as servers
Each of our computers serves as a backup of the server
Christopher Giroir Git for mere mortals
Internals Usage Distribution Merging and Rebasing Extras
Architecture
Location Descriptions
Git has 4 locations where commits are stored
Remote Repo Any remote object store
Local Repo You local object store
Index A single spot to “stage” commits
Working Directory These are the files you are editing
Christopher Giroir Git for mere mortals
Internals Usage Distribution Merging and Rebasing Extras
Command Examples
Locations and Commands
Working
git add

Index
git commit
Local Repo
git push
##
git checkout
gg
Remote Repo
git fetch
cc
BC@A
git pull
OO
Christopher Giroir Git for mere mortals
Internals Usage Distribution Merging and Rebasing Extras
Merging
Fast Forward Merging
git checkout master
git merge SAVE-234
?=89:;a //?=89:;b //?=89:;c //?=89:;d //?=89:;e
Master
SAVE-234
Christopher Giroir Git for mere mortals
Internals Usage Distribution Merging and Rebasing Extras
Merging
Merging
git checkout master
git merge SAVE-234
?=89:;a //?=89:;b //
aaaaaaaaa
?=89:;c //?=89:;d //?=89:;e //?=89:;76540123j
Master
?=89:;g //?=89:;h //?=89:;i
@@¢¢¢¢¢¢¢¢¢
SAVE-234
Christopher Giroir Git for mere mortals
Internals Usage Distribution Merging and Rebasing Extras
Merging
No Fast Forward Merging
git checkout master
git merge --no-ff SAVE-234
?=89:;a //?=89:;b
bbbbbbbbb
//?=89:;76540123f
Master
?=89:;c //?=89:;d //?=89:;e
@@         
SAVE-234
Christopher Giroir Git for mere mortals
Internals Usage Distribution Merging and Rebasing Extras
Rebase
Rebase
git checkout SAVE-234
git rebase master
?=89:;a //?=89:;b //?=89:;c //?=89:;d //?=89:;e
wwooooooooooooooooo
Master
GFED@ABC?=89:;g //GFED@ABC?=89:;h //ONMLHIJKGFED@ABCi
SAVE-234
Christopher Giroir Git for mere mortals
Internals Usage Distribution Merging and Rebasing Extras
Remotes
Remote Commands
Adding remote
git remote add origin
git@github.com:Kelsin/configs.git
Fetch all remote objects
git fetch
Show all branches
git branch -a
Christopher Giroir Git for mere mortals
Internals Usage Distribution Merging and Rebasing Extras
Remotes
Pushing
Push objects from source to destination
git push origin source:destination
Removing remote branch
git push origin :destination
Setting upstream
git push -u origin SAVE-453
Force pushes
git push -f origin SAVE-453
Christopher Giroir Git for mere mortals
Internals Usage Distribution Merging and Rebasing Extras
Remotes
Pulling
Pull in remote changes
git pull origin master
Special case
Executes:
git fetch
git merge
Merges in to your current branch
Christopher Giroir Git for mere mortals
Internals Usage Distribution Merging and Rebasing Extras
Misc
Git Config File
My git config is available at
https://github.com/Kelsin/configs/blob/master/.gitconfig
Push defaults
Commiter name and email
Color settings
Aliases
Christopher Giroir Git for mere mortals
Internals Usage Distribution Merging and Rebasing Extras
Misc
Some Tips
Always work on branches
When in doubt use GitX or gitk to see what you are doing
When in doubt save a new branch so you can always get back
Add the current git branch into your prompt
Explore with rebase and cleaning up code before final push
Christopher Giroir Git for mere mortals

More Related Content

What's hot

git. WTF is it doing anyway?
git. WTF is it doing anyway?git. WTF is it doing anyway?
git. WTF is it doing anyway?Erin Zimmer
 
Introduction To Git Workshop
Introduction To Git WorkshopIntroduction To Git Workshop
Introduction To Git Workshopthemystic_ca
 
Code reviews vs Pull requests
Code reviews vs Pull requestsCode reviews vs Pull requests
Code reviews vs Pull requestsTim Pettersen
 
Git Magic: Versioning Files like a Boss
Git Magic: Versioning Files like a BossGit Magic: Versioning Files like a Boss
Git Magic: Versioning Files like a Bosstmacwilliam
 
Beating Python's GIL to Max Out Your CPUs
Beating Python's GIL to Max Out Your CPUsBeating Python's GIL to Max Out Your CPUs
Beating Python's GIL to Max Out Your CPUsAndrew Montalenti
 
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 GitE Carter
 
Git session Dropsolid.com
Git session Dropsolid.comGit session Dropsolid.com
Git session Dropsolid.comdropsolid
 
Introduction to Git Version Control System
Introduction to Git Version Control SystemIntroduction to Git Version Control System
Introduction to Git Version Control SystemOleksandr Zaitsev
 
[로켓 자바] Part 1 성능 튜닝 마인드 확립
[로켓 자바] Part 1 성능 튜닝 마인드 확립[로켓 자바] Part 1 성능 튜닝 마인드 확립
[로켓 자바] Part 1 성능 튜닝 마인드 확립Covenant Ko
 
Git: An introduction of plumbing and porcelain commands
Git: An introduction of plumbing and porcelain commandsGit: An introduction of plumbing and porcelain commands
Git: An introduction of plumbing and porcelain commandsth507
 
JPA Week5. Join Fetch
JPA Week5. Join FetchJPA Week5. Join Fetch
JPA Week5. Join FetchCovenant Ko
 
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 messesKatie Sylor-Miller
 
DevOpsDays PDX - Batteries Included: Enabling Community Contribution
DevOpsDays PDX - Batteries Included: Enabling Community ContributionDevOpsDays PDX - Batteries Included: Enabling Community Contribution
DevOpsDays PDX - Batteries Included: Enabling Community ContributionAaron Aldrich
 
Tracking large game assets with Git LFS
Tracking large game assets with Git LFSTracking large game assets with Git LFS
Tracking large game assets with Git LFSTim Pettersen
 

What's hot (20)

git. WTF is it doing anyway?
git. WTF is it doing anyway?git. WTF is it doing anyway?
git. WTF is it doing anyway?
 
Introduction To Git Workshop
Introduction To Git WorkshopIntroduction To Git Workshop
Introduction To Git Workshop
 
Code reviews vs Pull requests
Code reviews vs Pull requestsCode reviews vs Pull requests
Code reviews vs Pull requests
 
Git Magic: Versioning Files like a Boss
Git Magic: Versioning Files like a BossGit Magic: Versioning Files like a Boss
Git Magic: Versioning Files like a Boss
 
Beating Python's GIL to Max Out Your CPUs
Beating Python's GIL to Max Out Your CPUsBeating Python's GIL to Max Out Your CPUs
Beating Python's GIL to Max Out Your CPUs
 
Bitbucket
BitbucketBitbucket
Bitbucket
 
Git & GitHub WorkShop
Git & GitHub WorkShopGit & GitHub WorkShop
Git & GitHub WorkShop
 
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
 
Git session Dropsolid.com
Git session Dropsolid.comGit session Dropsolid.com
Git session Dropsolid.com
 
Git real slides
Git real slidesGit real slides
Git real slides
 
Introduction to Git Version Control System
Introduction to Git Version Control SystemIntroduction to Git Version Control System
Introduction to Git Version Control System
 
[로켓 자바] Part 1 성능 튜닝 마인드 확립
[로켓 자바] Part 1 성능 튜닝 마인드 확립[로켓 자바] Part 1 성능 튜닝 마인드 확립
[로켓 자바] Part 1 성능 튜닝 마인드 확립
 
Git SCM
Git SCMGit SCM
Git SCM
 
Git: An introduction of plumbing and porcelain commands
Git: An introduction of plumbing and porcelain commandsGit: An introduction of plumbing and porcelain commands
Git: An introduction of plumbing and porcelain commands
 
JPA Week5. Join Fetch
JPA Week5. Join FetchJPA Week5. Join Fetch
JPA Week5. Join Fetch
 
git and github
git and githubgit and github
git and github
 
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
 
DevOpsDays PDX - Batteries Included: Enabling Community Contribution
DevOpsDays PDX - Batteries Included: Enabling Community ContributionDevOpsDays PDX - Batteries Included: Enabling Community Contribution
DevOpsDays PDX - Batteries Included: Enabling Community Contribution
 
Tracking large game assets with Git LFS
Tracking large game assets with Git LFSTracking large game assets with Git LFS
Tracking large game assets with Git LFS
 
Git 101 for Beginners
Git 101 for Beginners Git 101 for Beginners
Git 101 for Beginners
 

Similar to Git Presentation - Handout

Git 入门 与 实践
Git 入门 与 实践Git 入门 与 实践
Git 入门 与 实践Terry Wang
 
Git 入门与实践
Git 入门与实践Git 入门与实践
Git 入门与实践Terry Wang
 
Git Commands Every Developer Should Know?
Git Commands Every Developer Should Know?Git Commands Every Developer Should Know?
Git Commands Every Developer Should Know?9 series
 
Distributed Developer Workflows using Git
Distributed Developer Workflows using GitDistributed Developer Workflows using Git
Distributed Developer Workflows using GitSusan Potter
 
Introduction to Git and Github
Introduction to Git and Github Introduction to Git and Github
Introduction to Git and Github Max Claus Nunes
 
Git - An Introduction
Git - An IntroductionGit - An Introduction
Git - An IntroductionBehzad Altaf
 
Gitting the Most From Git
Gitting the Most From GitGitting the Most From Git
Gitting the Most From GitChris Miller
 
Git Distributed Version Control System
Git   Distributed Version Control SystemGit   Distributed Version Control System
Git Distributed Version Control SystemVictor Wong
 
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 UnityRifauddin Tsalitsy
 
An introduction to Git
An introduction to GitAn introduction to Git
An introduction to GitMuhil Vannan
 
Git interview questions | Edureka
Git interview questions | EdurekaGit interview questions | Edureka
Git interview questions | EdurekaEdureka!
 

Similar to Git Presentation - Handout (20)

Git 入门 与 实践
Git 入门 与 实践Git 入门 与 实践
Git 入门 与 实践
 
Git
GitGit
Git
 
Git 入门与实践
Git 入门与实践Git 入门与实践
Git 入门与实践
 
Git Commands Every Developer Should Know?
Git Commands Every Developer Should Know?Git Commands Every Developer Should Know?
Git Commands Every Developer Should Know?
 
Git and git hub
Git and git hubGit and git hub
Git and git hub
 
Distributed Developer Workflows using Git
Distributed Developer Workflows using GitDistributed Developer Workflows using Git
Distributed Developer Workflows using Git
 
Introduction to Git and Github
Introduction to Git and Github Introduction to Git and Github
Introduction to Git and Github
 
Git Tech Talk
Git  Tech TalkGit  Tech Talk
Git Tech Talk
 
Git - An Introduction
Git - An IntroductionGit - An Introduction
Git - An Introduction
 
Gitting the Most From Git
Gitting the Most From GitGitting the Most From Git
Gitting the Most From Git
 
Git Distributed Version Control System
Git   Distributed Version Control SystemGit   Distributed Version Control System
Git Distributed Version Control System
 
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
 
Git presentation
Git presentationGit presentation
Git presentation
 
Git training v10
Git training v10Git training v10
Git training v10
 
An introduction to Git
An introduction to GitAn introduction to Git
An introduction to Git
 
Git & gitflow
Git & gitflowGit & gitflow
Git & gitflow
 
Git github
Git githubGit github
Git github
 
Introduction to Git (Greg Lonnon)
Introduction to Git (Greg Lonnon)Introduction to Git (Greg Lonnon)
Introduction to Git (Greg Lonnon)
 
Github By Nyros Developer
Github By Nyros DeveloperGithub By Nyros Developer
Github By Nyros Developer
 
Git interview questions | Edureka
Git interview questions | EdurekaGit interview questions | Edureka
Git interview questions | Edureka
 

Recently uploaded

Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 

Recently uploaded (20)

Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 

Git Presentation - Handout

  • 1. Internals Usage Distribution Merging and Rebasing Extras Git for mere mortals https://github.com/Kelsin/git-presentation Christopher Giroir July 26th, 2011 Christopher Giroir Git for mere mortals Internals Usage Distribution Merging and Rebasing Extras 1 Internals Objects Branches and Tags 2 Usage Creating and Commiting Inspection 3 Distribution Advantages Architecture Command Examples 4 Merging and Rebasing Merging Rebase 5 Extras Remotes Misc Christopher Giroir Git for mere mortals Internals Usage Distribution Merging and Rebasing Extras Objects Object Store The git object store is a big black box and we like it that way. It was written for speed and correctness Comparisons More information than CVS More sane than SVN More efficient than Mercurial Christopher Giroir Git for mere mortals Internals Usage Distribution Merging and Rebasing Extras Objects Blobs _^]XYZ[Blob Blobs store file data (text or binary). Labeled by SHA1. If the content changes, so does the SHA. Christopher Giroir Git for mere mortals
  • 2. Internals Usage Distribution Merging and Rebasing Extras Objects Trees _^]XYZ[Blob _^]XYZ[Tree // ?? _^]XYZ[Blob Trees point to blobs Represent the entire state of the working directory Also labeled by SHA’s. Christopher Giroir Git for mere mortals Internals Usage Distribution Merging and Rebasing Extras Objects Commits onmlhijkCommit _^]XYZ[Blob onmlhijkCommit OO //_^]XYZ[Tree CC§§§§§§§§§§§§§ //_^]XYZ[Blob Points to a tree object and parent commit(s) Stores author and date information Labeled by SHA’s. Christopher Giroir Git for mere mortals Internals Usage Distribution Merging and Rebasing Extras Objects Important Distinction! Commits link to entires TREES not DIFFS. Diffs are not stored in git, they are computed. Christopher Giroir Git for mere mortals Internals Usage Distribution Merging and Rebasing Extras Branches and Tags Pointers Most other things in git are pointers to commits. ?>=<89:;a // v3.0.1 ?>=<89:;b // bbbbbbbbb Master ?=89:;c //?=89:;d //?=89:;e SAVE-465 ?=89:;g // origin/SAVE-576 ?=89:;h //?=89:;i SAVE-576 Branches are just labels to commit SHA’s Tags are just labels with meta information Christopher Giroir Git for mere mortals
  • 3. Internals Usage Distribution Merging and Rebasing Extras Branches and Tags Rewriting History Rewriting a commit changes it’s SHA Any commit after it changes as well Most branch operations are quick and painless Can shoot yourself in the foot and heal it back up again Christopher Giroir Git for mere mortals Internals Usage Distribution Merging and Rebasing Extras Creating and Commiting Starting Out Setting User Info git config --global user.name Christopher Giroir git config --global user.email kelsin@valefor.com Completely New Repo cd dir-with-code git init Cloning any accessible repo git clone git@github.com:Kelsin/configs.git cd configs Christopher Giroir Git for mere mortals Internals Usage Distribution Merging and Rebasing Extras Creating and Commiting Commits Initial Commit git add . git commit -m Initial Commit Editing some files git add edited-file.rb git commit -m Improved everything Adding to previous commit git add edited-file.rb git commit --amend Christopher Giroir Git for mere mortals Internals Usage Distribution Merging and Rebasing Extras Inspection Status and Diffs Normal Status git status What’s current changed? git diff Changes from only one file git diff example-file.rb Changes between branches git diff master Christopher Giroir Git for mere mortals
  • 4. Internals Usage Distribution Merging and Rebasing Extras Inspection Show and Log Show current commit git show Show some other commit git show 234ab32 Show log of recent commits git log Show pretty log git log --graph --decorate --oneline Christopher Giroir Git for mere mortals Internals Usage Distribution Merging and Rebasing Extras Inspection Refs and Objects By commit id git show 234ab32 By branch git show master By tag git show v3.0.2 Relative git show HEAD^ Christopher Giroir Git for mere mortals Internals Usage Distribution Merging and Rebasing Extras Advantages Distributed Source Control Only difference from remote and local (normally): working directories Can function offline Can “push” and “pull” from each other, as well as servers Each of our computers serves as a backup of the server Christopher Giroir Git for mere mortals Internals Usage Distribution Merging and Rebasing Extras Architecture Location Descriptions Git has 4 locations where commits are stored Remote Repo Any remote object store Local Repo You local object store Index A single spot to “stage” commits Working Directory These are the files you are editing Christopher Giroir Git for mere mortals
  • 5. Internals Usage Distribution Merging and Rebasing Extras Command Examples Locations and Commands Working git add Index git commit Local Repo git push ## git checkout gg Remote Repo git fetch cc BC@A git pull OO Christopher Giroir Git for mere mortals Internals Usage Distribution Merging and Rebasing Extras Merging Fast Forward Merging git checkout master git merge SAVE-234 ?=89:;a //?=89:;b //?=89:;c //?=89:;d //?=89:;e Master SAVE-234 Christopher Giroir Git for mere mortals Internals Usage Distribution Merging and Rebasing Extras Merging Merging git checkout master git merge SAVE-234 ?=89:;a //?=89:;b // aaaaaaaaa ?=89:;c //?=89:;d //?=89:;e //?=89:;76540123j Master ?=89:;g //?=89:;h //?=89:;i @@¢¢¢¢¢¢¢¢¢ SAVE-234 Christopher Giroir Git for mere mortals Internals Usage Distribution Merging and Rebasing Extras Merging No Fast Forward Merging git checkout master git merge --no-ff SAVE-234 ?=89:;a //?=89:;b bbbbbbbbb //?=89:;76540123f Master ?=89:;c //?=89:;d //?=89:;e @@          SAVE-234 Christopher Giroir Git for mere mortals
  • 6. Internals Usage Distribution Merging and Rebasing Extras Rebase Rebase git checkout SAVE-234 git rebase master ?=89:;a //?=89:;b //?=89:;c //?=89:;d //?=89:;e wwooooooooooooooooo Master GFED@ABC?=89:;g //GFED@ABC?=89:;h //ONMLHIJKGFED@ABCi SAVE-234 Christopher Giroir Git for mere mortals Internals Usage Distribution Merging and Rebasing Extras Remotes Remote Commands Adding remote git remote add origin git@github.com:Kelsin/configs.git Fetch all remote objects git fetch Show all branches git branch -a Christopher Giroir Git for mere mortals Internals Usage Distribution Merging and Rebasing Extras Remotes Pushing Push objects from source to destination git push origin source:destination Removing remote branch git push origin :destination Setting upstream git push -u origin SAVE-453 Force pushes git push -f origin SAVE-453 Christopher Giroir Git for mere mortals Internals Usage Distribution Merging and Rebasing Extras Remotes Pulling Pull in remote changes git pull origin master Special case Executes: git fetch git merge Merges in to your current branch Christopher Giroir Git for mere mortals
  • 7. Internals Usage Distribution Merging and Rebasing Extras Misc Git Config File My git config is available at https://github.com/Kelsin/configs/blob/master/.gitconfig Push defaults Commiter name and email Color settings Aliases Christopher Giroir Git for mere mortals Internals Usage Distribution Merging and Rebasing Extras Misc Some Tips Always work on branches When in doubt use GitX or gitk to see what you are doing When in doubt save a new branch so you can always get back Add the current git branch into your prompt Explore with rebase and cleaning up code before final push Christopher Giroir Git for mere mortals