SlideShare a Scribd company logo
1 of 30
Advanced Git
for Beginners
Derrick Stolee
Microsoft
@stolee
https://stolee.dev/docs/git.pptx
Where to Get Git?
• Linux: sudo apt-get install git
• Windows: https://github.com/git-for-windows/git/releases
• Mac: brew install git
https://git-scm.com/book/en/v2/Getting-Started-Installing-Git
How to follow along?
$ git clone https://github.com/git/git
$ cd git
$ git reset --hard v2.23.0
How to follow along?
$ git clone https://github.com/git/git
$ cd git
$ git reset --hard v2.23.0
Object Model
Object Model:
Content-Addressable Data Store
• Every object has a SHA-1 hash: 40 hex characters.
• Given 40 hex characters, we can find the unique object with that hash.
Object Model:
Content-Addressable Data Store
Object Model: Blob (Block)
• A blob contains file contents.
Note: the file name is
not part of the object!
Object Model: Tree (Triangle)
• A tree contains folder contents.
Contains names of files
and folders inside
Contains blobs (files)
and trees (folders)
Includes file mode
(Unix file permissions)
Object Model: Tree (Triangle)
• A tree contains folder contents.
Object Model: Commit (Circle)
• A commit contains many things:
 A root tree.
 A list of parent commits.
 A commit message
 An author name, email, time.
 A committer name, email, time.
git config –global user.name “My Name”
git config --global user.email me@place.com
Object Model: Commit (Circle)
• A commit contains many things:
 A root tree.
 A list of parent commits.
 A commit message
 An author name, email, time.
 A committer name, email, time.
Object Model: Commit (Circle)
• A commit contains many things:
 A root tree.
 A list of parent commits.
 A commit message
 An author name, email, time.
 A committer name, email, time.
Object Model: Merkle Tree
IMPORTANT: Commits are NOT diffs!
File renames are
Detected dynamically!
Branches: Pointers to commits
topic
master
HEAD
shipped
git is DISTRIBUTED version control!
topic
master
HEAD
shipped
git switch : move between branches
• (New in v2.23.0, replaces half of “git checkout”)
• Change HEAD to point to new branch
• Updates working directory to match commit’s tree
Working Directory, Staging, Committed
https://stackoverflow.com/questions/3689838/whats-the-difference-between-head-working-tree-and-index-in-git
EXAMPLE!
Working Directory, Staging, Committed
https://git-scm.com/book/en/v2/Git-Basics-Recording-Changes-to-the-Repository
EXAMPLE!
Advanced!
Working Directory, Staging, Committed
https://git-scm.com/docs/git-add#Documentation/git-add.txt-patch
EXAMPLE!
Interactive add: git add -p
Presents the patch-diff in parts that you can add in pieces, or even modify in-place!
git add -p
git commit -a
git status is your friend
Working with Remotes
• If you clone, you create special remote ‘origin’.
• You can have a LOT of remotes!
Working with Remotes
Get new data: git fetch <remote> [branch]
Upload your data: git push <remote> <branch>
Hot Take: Don’t use git pull! This does the following:
1. git fetch
2. git merge
This can have unexpected results! Instead, do your merges yourself!
https://stackoverflow.com/questions/3689838/whats-the-difference-between-head-working-tree-and-index-in-git
Stop! Collaborate! Listen!
https://github.com/microsoft/git/pull/180
Git Commands to Look Up
git config
git log
git rebase
git merge
git fetch
git push
git add
git status
git reset
git checkout
git switch
git restore
git diff
git remote
Reading List
• These slides: https://stolee.dev/docs/git.pptx
• https://git-scm.com/doc
• https://ohshitgit.com/
• http://stevelosh.com/blog/2013/04/git-koans/
• File History Simplification
• What’s the difference between HEAD, working tree and index?
• Write Yourself a Git
• Supercharging the Git Commit Graph
 Part I
 Part II
 Part III
 Part IV
• Exploring new frontiers for Git push performance
Available roles and opportunities
SE & Program
Manager (PM)
Internship
Explore Microsoft Full-Time
SE & PM
Links to these applications are also found at
https://microsoft.com/university
Bonus! Tags: pointers to anything
t1
t2
t3

More Related Content

Similar to git.pptx

Similar to git.pptx (20)

Git slides
Git slidesGit slides
Git slides
 
Advanced git
Advanced gitAdvanced git
Advanced git
 
Version control with GIT
Version control with GITVersion control with GIT
Version control with GIT
 
Git session Dropsolid.com
Git session Dropsolid.comGit session Dropsolid.com
Git session Dropsolid.com
 
390a gitintro 12au
390a gitintro 12au390a gitintro 12au
390a gitintro 12au
 
Let's Git this Party Started: An Introduction to Git and GitHub
Let's Git this Party Started: An Introduction to Git and GitHubLet's Git this Party Started: An Introduction to Git and GitHub
Let's Git this Party Started: An Introduction to Git and GitHub
 
sample.pptx
sample.pptxsample.pptx
sample.pptx
 
Source control management
Source control managementSource control management
Source control management
 
Introduction to Git and Github
Introduction to Git and GithubIntroduction to Git and Github
Introduction to Git and Github
 
Git 101 - Crash Course in Version Control using Git
Git 101 - Crash Course in Version Control using GitGit 101 - Crash Course in Version Control using Git
Git 101 - Crash Course in Version Control using Git
 
Introduction to git
Introduction to gitIntroduction to git
Introduction to git
 
Git Is A State Of Mind - The path to becoming a Master of the mystic art of Git
Git Is A State Of Mind - The path to becoming a Master of the mystic art of GitGit Is A State Of Mind - The path to becoming a Master of the mystic art of Git
Git Is A State Of Mind - The path to becoming a Master of the mystic art of Git
 
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
 
Git 101 Workshop
Git 101 WorkshopGit 101 Workshop
Git 101 Workshop
 
Embedded Systems: Lecture 11: Introduction to Git & GitHub (Part 2)
Embedded Systems: Lecture 11: Introduction to Git & GitHub (Part 2)Embedded Systems: Lecture 11: Introduction to Git & GitHub (Part 2)
Embedded Systems: Lecture 11: Introduction to Git & GitHub (Part 2)
 
Gittalk
GittalkGittalk
Gittalk
 
GIT-FirstPart.ppt
GIT-FirstPart.pptGIT-FirstPart.ppt
GIT-FirstPart.ppt
 
Git installation and configuration
Git installation and configurationGit installation and configuration
Git installation and configuration
 
Git hub
Git hubGit hub
Git hub
 
Git 101 for Beginners
Git 101 for Beginners Git 101 for Beginners
Git 101 for Beginners
 

Recently uploaded

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
Enterprise Knowledge
 

Recently uploaded (20)

[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
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
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
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
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
 
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
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
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
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
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
 
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
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
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
 

git.pptx

  • 1. Advanced Git for Beginners Derrick Stolee Microsoft @stolee https://stolee.dev/docs/git.pptx
  • 2. Where to Get Git? • Linux: sudo apt-get install git • Windows: https://github.com/git-for-windows/git/releases • Mac: brew install git https://git-scm.com/book/en/v2/Getting-Started-Installing-Git
  • 3. How to follow along? $ git clone https://github.com/git/git $ cd git $ git reset --hard v2.23.0
  • 4. How to follow along? $ git clone https://github.com/git/git $ cd git $ git reset --hard v2.23.0
  • 6. Object Model: Content-Addressable Data Store • Every object has a SHA-1 hash: 40 hex characters. • Given 40 hex characters, we can find the unique object with that hash.
  • 8. Object Model: Blob (Block) • A blob contains file contents. Note: the file name is not part of the object!
  • 9. Object Model: Tree (Triangle) • A tree contains folder contents. Contains names of files and folders inside Contains blobs (files) and trees (folders) Includes file mode (Unix file permissions)
  • 10. Object Model: Tree (Triangle) • A tree contains folder contents.
  • 11. Object Model: Commit (Circle) • A commit contains many things:  A root tree.  A list of parent commits.  A commit message  An author name, email, time.  A committer name, email, time. git config –global user.name “My Name” git config --global user.email me@place.com
  • 12. Object Model: Commit (Circle) • A commit contains many things:  A root tree.  A list of parent commits.  A commit message  An author name, email, time.  A committer name, email, time.
  • 13. Object Model: Commit (Circle) • A commit contains many things:  A root tree.  A list of parent commits.  A commit message  An author name, email, time.  A committer name, email, time.
  • 15. IMPORTANT: Commits are NOT diffs! File renames are Detected dynamically!
  • 16. Branches: Pointers to commits topic master HEAD shipped
  • 17. git is DISTRIBUTED version control! topic master HEAD shipped
  • 18. git switch : move between branches • (New in v2.23.0, replaces half of “git checkout”) • Change HEAD to point to new branch • Updates working directory to match commit’s tree
  • 19. Working Directory, Staging, Committed https://stackoverflow.com/questions/3689838/whats-the-difference-between-head-working-tree-and-index-in-git EXAMPLE!
  • 20. Working Directory, Staging, Committed https://git-scm.com/book/en/v2/Git-Basics-Recording-Changes-to-the-Repository EXAMPLE!
  • 21. Advanced! Working Directory, Staging, Committed https://git-scm.com/docs/git-add#Documentation/git-add.txt-patch EXAMPLE! Interactive add: git add -p Presents the patch-diff in parts that you can add in pieces, or even modify in-place! git add -p git commit -a
  • 22. git status is your friend
  • 23. Working with Remotes • If you clone, you create special remote ‘origin’. • You can have a LOT of remotes!
  • 24. Working with Remotes Get new data: git fetch <remote> [branch] Upload your data: git push <remote> <branch> Hot Take: Don’t use git pull! This does the following: 1. git fetch 2. git merge This can have unexpected results! Instead, do your merges yourself!
  • 27. Git Commands to Look Up git config git log git rebase git merge git fetch git push git add git status git reset git checkout git switch git restore git diff git remote
  • 28. Reading List • These slides: https://stolee.dev/docs/git.pptx • https://git-scm.com/doc • https://ohshitgit.com/ • http://stevelosh.com/blog/2013/04/git-koans/ • File History Simplification • What’s the difference between HEAD, working tree and index? • Write Yourself a Git • Supercharging the Git Commit Graph  Part I  Part II  Part III  Part IV • Exploring new frontiers for Git push performance
  • 29. Available roles and opportunities SE & Program Manager (PM) Internship Explore Microsoft Full-Time SE & PM Links to these applications are also found at https://microsoft.com/university
  • 30. Bonus! Tags: pointers to anything t1 t2 t3