git fundamentals - pauby.com · git fundamentals open up a world of community and collaboration •...
TRANSCRIPT
![Page 1: Git Fundamentals - pauby.com · Git Fundamentals Open up a world of community and collaboration • Paul Broadwith, Glasgow, Scotland • 25+ years in defence, government, financial](https://reader034.vdocuments.site/reader034/viewer/2022042802/5f37e00bb96db9360d214908/html5/thumbnails/1.jpg)
Paul Broadwith@pauby
https://blog.pauby.com
Git FundamentalsOpen up a world of community and collaboration
![Page 2: Git Fundamentals - pauby.com · Git Fundamentals Open up a world of community and collaboration • Paul Broadwith, Glasgow, Scotland • 25+ years in defence, government, financial](https://reader034.vdocuments.site/reader034/viewer/2022042802/5f37e00bb96db9360d214908/html5/thumbnails/2.jpg)
![Page 3: Git Fundamentals - pauby.com · Git Fundamentals Open up a world of community and collaboration • Paul Broadwith, Glasgow, Scotland • 25+ years in defence, government, financial](https://reader034.vdocuments.site/reader034/viewer/2022042802/5f37e00bb96db9360d214908/html5/thumbnails/3.jpg)
• Paul Broadwith, Glasgow, Scotland
• 25+ years in defence, government, financial sectors
• Lead Engineer on Boxstarter and Chocolatey cChoco DSC Resource
Who Am I?
![Page 4: Git Fundamentals - pauby.com · Git Fundamentals Open up a world of community and collaboration • Paul Broadwith, Glasgow, Scotland • 25+ years in defence, government, financial](https://reader034.vdocuments.site/reader034/viewer/2022042802/5f37e00bb96db9360d214908/html5/thumbnails/4.jpg)
Questions At The End?
![Page 5: Git Fundamentals - pauby.com · Git Fundamentals Open up a world of community and collaboration • Paul Broadwith, Glasgow, Scotland • 25+ years in defence, government, financial](https://reader034.vdocuments.site/reader034/viewer/2022042802/5f37e00bb96db9360d214908/html5/thumbnails/5.jpg)
In This Session
• What actually is Git?
• What tools do I need for Git?
• Who is using Git and why do I need to use it?
• How does Git work?
• Git commands you need to know!
• What is a Pull Request and what they are used for;
• How to work with Open Source projects using Git;
![Page 6: Git Fundamentals - pauby.com · Git Fundamentals Open up a world of community and collaboration • Paul Broadwith, Glasgow, Scotland • 25+ years in defence, government, financial](https://reader034.vdocuments.site/reader034/viewer/2022042802/5f37e00bb96db9360d214908/html5/thumbnails/6.jpg)
Who Is This Aimed At?
Level 100
![Page 7: Git Fundamentals - pauby.com · Git Fundamentals Open up a world of community and collaboration • Paul Broadwith, Glasgow, Scotland • 25+ years in defence, government, financial](https://reader034.vdocuments.site/reader034/viewer/2022042802/5f37e00bb96db9360d214908/html5/thumbnails/7.jpg)
![Page 8: Git Fundamentals - pauby.com · Git Fundamentals Open up a world of community and collaboration • Paul Broadwith, Glasgow, Scotland • 25+ years in defence, government, financial](https://reader034.vdocuments.site/reader034/viewer/2022042802/5f37e00bb96db9360d214908/html5/thumbnails/8.jpg)
Git
is not
GitHub
![Page 9: Git Fundamentals - pauby.com · Git Fundamentals Open up a world of community and collaboration • Paul Broadwith, Glasgow, Scotland • 25+ years in defence, government, financial](https://reader034.vdocuments.site/reader034/viewer/2022042802/5f37e00bb96db9360d214908/html5/thumbnails/9.jpg)
What Is Git?
![Page 10: Git Fundamentals - pauby.com · Git Fundamentals Open up a world of community and collaboration • Paul Broadwith, Glasgow, Scotland • 25+ years in defence, government, financial](https://reader034.vdocuments.site/reader034/viewer/2022042802/5f37e00bb96db9360d214908/html5/thumbnails/10.jpg)
What Is Git?
Wikipedia defines Git as:
Git is a version control system for tracking changes in computer files and coordinating work on those files among multiple people. It is primarily used for source code management in software development, but it can be used to keep track of changes in any set of files. As a distributed revision control system it is aimed at speed, data integrity, and support for distributed, non-linear workflows.
• https://en.wikipedia.org/wiki/Git
![Page 11: Git Fundamentals - pauby.com · Git Fundamentals Open up a world of community and collaboration • Paul Broadwith, Glasgow, Scotland • 25+ years in defence, government, financial](https://reader034.vdocuments.site/reader034/viewer/2022042802/5f37e00bb96db9360d214908/html5/thumbnails/11.jpg)
What Is Git?
Which means Git is:
Git is a version control system for tracking changes in computer files. It is aimed at speed and data integrity.
![Page 12: Git Fundamentals - pauby.com · Git Fundamentals Open up a world of community and collaboration • Paul Broadwith, Glasgow, Scotland • 25+ years in defence, government, financial](https://reader034.vdocuments.site/reader034/viewer/2022042802/5f37e00bb96db9360d214908/html5/thumbnails/12.jpg)
What Is Git?
Wikipedia defines Version Control System as:
… version control is the management of changes to documents, computer programs, large web sites, and other collections of information. Changes are usually identified by a number or letter code, termed the "revision number“ … Each revision is associated with a timestamp and the person making the change. Revisions can be compared, restored, and with some types of files, merged.
• https://en.wikipedia.org/wiki/Version_contro
![Page 13: Git Fundamentals - pauby.com · Git Fundamentals Open up a world of community and collaboration • Paul Broadwith, Glasgow, Scotland • 25+ years in defence, government, financial](https://reader034.vdocuments.site/reader034/viewer/2022042802/5f37e00bb96db9360d214908/html5/thumbnails/13.jpg)
What Is Git?
Which means a version control system is:
Version control is the management of changes to collections of information. Changes are identified by a number associated with a timestamp and the person making the change.
![Page 14: Git Fundamentals - pauby.com · Git Fundamentals Open up a world of community and collaboration • Paul Broadwith, Glasgow, Scotland • 25+ years in defence, government, financial](https://reader034.vdocuments.site/reader034/viewer/2022042802/5f37e00bb96db9360d214908/html5/thumbnails/14.jpg)
What Tools Do I Need?
![Page 15: Git Fundamentals - pauby.com · Git Fundamentals Open up a world of community and collaboration • Paul Broadwith, Glasgow, Scotland • 25+ years in defence, government, financial](https://reader034.vdocuments.site/reader034/viewer/2022042802/5f37e00bb96db9360d214908/html5/thumbnails/15.jpg)
Recommended Software
https://chocolatey.org
https://chocolatey.org/install
![Page 16: Git Fundamentals - pauby.com · Git Fundamentals Open up a world of community and collaboration • Paul Broadwith, Glasgow, Scotland • 25+ years in defence, government, financial](https://reader034.vdocuments.site/reader034/viewer/2022042802/5f37e00bb96db9360d214908/html5/thumbnails/16.jpg)
Required Tools
Git Tools
> choco install git -y
https://gitforwindows.org/
https://git-scm.com/download/mac
> apt install git-all
![Page 17: Git Fundamentals - pauby.com · Git Fundamentals Open up a world of community and collaboration • Paul Broadwith, Glasgow, Scotland • 25+ years in defence, government, financial](https://reader034.vdocuments.site/reader034/viewer/2022042802/5f37e00bb96db9360d214908/html5/thumbnails/17.jpg)
Recommended Tools
Git Credential Manager For Windows
Git Extensions
GitHub Pull Requests
posh-git
PSGit
![Page 18: Git Fundamentals - pauby.com · Git Fundamentals Open up a world of community and collaboration • Paul Broadwith, Glasgow, Scotland • 25+ years in defence, government, financial](https://reader034.vdocuments.site/reader034/viewer/2022042802/5f37e00bb96db9360d214908/html5/thumbnails/18.jpg)
Who uses Git?
![Page 19: Git Fundamentals - pauby.com · Git Fundamentals Open up a world of community and collaboration • Paul Broadwith, Glasgow, Scotland • 25+ years in defence, government, financial](https://reader034.vdocuments.site/reader034/viewer/2022042802/5f37e00bb96db9360d214908/html5/thumbnails/19.jpg)
Companies & Projects You Know
![Page 20: Git Fundamentals - pauby.com · Git Fundamentals Open up a world of community and collaboration • Paul Broadwith, Glasgow, Scotland • 25+ years in defence, government, financial](https://reader034.vdocuments.site/reader034/viewer/2022042802/5f37e00bb96db9360d214908/html5/thumbnails/20.jpg)
Git Providers & Software
![Page 21: Git Fundamentals - pauby.com · Git Fundamentals Open up a world of community and collaboration • Paul Broadwith, Glasgow, Scotland • 25+ years in defence, government, financial](https://reader034.vdocuments.site/reader034/viewer/2022042802/5f37e00bb96db9360d214908/html5/thumbnails/21.jpg)
Microsoft Windows & GVFS
8421
2500
4352
1760
Code Pushes (per day)
Pull Requests (per day)
Active Branches
Windows Builds (per day)
https://blogs.msdn.microsoft.com/bharry/2017/05/24/the-largest-git-repo-on-the-planet/
As at May 2017 (Using GVFS)
![Page 22: Git Fundamentals - pauby.com · Git Fundamentals Open up a world of community and collaboration • Paul Broadwith, Glasgow, Scotland • 25+ years in defence, government, financial](https://reader034.vdocuments.site/reader034/viewer/2022042802/5f37e00bb96db9360d214908/html5/thumbnails/22.jpg)
DSCResources Repository Statistics
https://blogs.msdn.microsoft.com/powershell/2018/09/13/desired-state-configuration-dsc-planning-update-september-2018/
Since 1 January 2018
475 Pull Requests
300 Closed Issues
![Page 23: Git Fundamentals - pauby.com · Git Fundamentals Open up a world of community and collaboration • Paul Broadwith, Glasgow, Scotland • 25+ years in defence, government, financial](https://reader034.vdocuments.site/reader034/viewer/2022042802/5f37e00bb96db9360d214908/html5/thumbnails/23.jpg)
Who Uses Git?
Writers Websites
Developers, Coders& ScriptersCI / CD,
Runbooks,Cookbooks
![Page 24: Git Fundamentals - pauby.com · Git Fundamentals Open up a world of community and collaboration • Paul Broadwith, Glasgow, Scotland • 25+ years in defence, government, financial](https://reader034.vdocuments.site/reader034/viewer/2022042802/5f37e00bb96db9360d214908/html5/thumbnails/24.jpg)
Why Do I Need To Use Git?
![Page 25: Git Fundamentals - pauby.com · Git Fundamentals Open up a world of community and collaboration • Paul Broadwith, Glasgow, Scotland • 25+ years in defence, government, financial](https://reader034.vdocuments.site/reader034/viewer/2022042802/5f37e00bb96db9360d214908/html5/thumbnails/25.jpg)
If you write code …
… you are a developer
![Page 26: Git Fundamentals - pauby.com · Git Fundamentals Open up a world of community and collaboration • Paul Broadwith, Glasgow, Scotland • 25+ years in defence, government, financial](https://reader034.vdocuments.site/reader034/viewer/2022042802/5f37e00bb96db9360d214908/html5/thumbnails/26.jpg)
2017 GitHub Use
https://octoverse.github.com/
47 Million Pull Requests
24 Million Developers
25.3 Million Active Repositories
1 Billion Commits
![Page 27: Git Fundamentals - pauby.com · Git Fundamentals Open up a world of community and collaboration • Paul Broadwith, Glasgow, Scotland • 25+ years in defence, government, financial](https://reader034.vdocuments.site/reader034/viewer/2022042802/5f37e00bb96db9360d214908/html5/thumbnails/27.jpg)
Git Has Your Back
ChangeHistory
UndoMistakes Collaborate
CI / CD
Open Source
![Page 28: Git Fundamentals - pauby.com · Git Fundamentals Open up a world of community and collaboration • Paul Broadwith, Glasgow, Scotland • 25+ years in defence, government, financial](https://reader034.vdocuments.site/reader034/viewer/2022042802/5f37e00bb96db9360d214908/html5/thumbnails/28.jpg)
![Page 29: Git Fundamentals - pauby.com · Git Fundamentals Open up a world of community and collaboration • Paul Broadwith, Glasgow, Scotland • 25+ years in defence, government, financial](https://reader034.vdocuments.site/reader034/viewer/2022042802/5f37e00bb96db9360d214908/html5/thumbnails/29.jpg)
Even The Beards Use It
![Page 30: Git Fundamentals - pauby.com · Git Fundamentals Open up a world of community and collaboration • Paul Broadwith, Glasgow, Scotland • 25+ years in defence, government, financial](https://reader034.vdocuments.site/reader034/viewer/2022042802/5f37e00bb96db9360d214908/html5/thumbnails/30.jpg)
How Does Git Work?The 3 Stages Of Git
![Page 31: Git Fundamentals - pauby.com · Git Fundamentals Open up a world of community and collaboration • Paul Broadwith, Glasgow, Scotland • 25+ years in defence, government, financial](https://reader034.vdocuments.site/reader034/viewer/2022042802/5f37e00bb96db9360d214908/html5/thumbnails/31.jpg)
8 Essential Git Commands
status?
add+ pull
clone
push
checkoutcommit
remote
![Page 32: Git Fundamentals - pauby.com · Git Fundamentals Open up a world of community and collaboration • Paul Broadwith, Glasgow, Scotland • 25+ years in defence, government, financial](https://reader034.vdocuments.site/reader034/viewer/2022042802/5f37e00bb96db9360d214908/html5/thumbnails/32.jpg)
The 3 Stages
Unstaged Staged Committed
> git status> git add <. | FILES>
> git commit –m ‘Message’
Change source files
Stage changed files
Commit changes
![Page 33: Git Fundamentals - pauby.com · Git Fundamentals Open up a world of community and collaboration • Paul Broadwith, Glasgow, Scotland • 25+ years in defence, government, financial](https://reader034.vdocuments.site/reader034/viewer/2022042802/5f37e00bb96db9360d214908/html5/thumbnails/33.jpg)
The 5 Fundamental Building Blocks Of Git
commit
pull requests
repository
fork *
branches
![Page 34: Git Fundamentals - pauby.com · Git Fundamentals Open up a world of community and collaboration • Paul Broadwith, Glasgow, Scotland • 25+ years in defence, government, financial](https://reader034.vdocuments.site/reader034/viewer/2022042802/5f37e00bb96db9360d214908/html5/thumbnails/34.jpg)
What Is A Repository?
Just a folder where you store your project files
Repository / Repo – terminology - both used
myproj
![Page 35: Git Fundamentals - pauby.com · Git Fundamentals Open up a world of community and collaboration • Paul Broadwith, Glasgow, Scotland • 25+ years in defence, government, financial](https://reader034.vdocuments.site/reader034/viewer/2022042802/5f37e00bb96db9360d214908/html5/thumbnails/35.jpg)
How Do Branches Work?
master branch
update-doc branch
dev branch
fix-memory-leak branch
![Page 36: Git Fundamentals - pauby.com · Git Fundamentals Open up a world of community and collaboration • Paul Broadwith, Glasgow, Scotland • 25+ years in defence, government, financial](https://reader034.vdocuments.site/reader034/viewer/2022042802/5f37e00bb96db9360d214908/html5/thumbnails/36.jpg)
What Is A Commit?
When one or more changes have been applied to a branch, its called a … commit
Committed
> git commit –m ‘Message’
Commit changes
![Page 37: Git Fundamentals - pauby.com · Git Fundamentals Open up a world of community and collaboration • Paul Broadwith, Glasgow, Scotland • 25+ years in defence, government, financial](https://reader034.vdocuments.site/reader034/viewer/2022042802/5f37e00bb96db9360d214908/html5/thumbnails/37.jpg)
What Is A Fork?
cool-project my/cool-project
cool-project fork
repository link
Forking a repo is simply creating a linked copy of that repository. The link allows changes to be pulled or pushed to the original repository.
![Page 38: Git Fundamentals - pauby.com · Git Fundamentals Open up a world of community and collaboration • Paul Broadwith, Glasgow, Scotland • 25+ years in defence, government, financial](https://reader034.vdocuments.site/reader034/viewer/2022042802/5f37e00bb96db9360d214908/html5/thumbnails/38.jpg)
What Is A Pull Request?
Allows review and discussion around those changes.
master branch
update-doc branch
Lets others know about a change you have made.
![Page 39: Git Fundamentals - pauby.com · Git Fundamentals Open up a world of community and collaboration • Paul Broadwith, Glasgow, Scotland • 25+ years in defence, government, financial](https://reader034.vdocuments.site/reader034/viewer/2022042802/5f37e00bb96db9360d214908/html5/thumbnails/39.jpg)
Essential Git Commands
![Page 40: Git Fundamentals - pauby.com · Git Fundamentals Open up a world of community and collaboration • Paul Broadwith, Glasgow, Scotland • 25+ years in defence, government, financial](https://reader034.vdocuments.site/reader034/viewer/2022042802/5f37e00bb96db9360d214908/html5/thumbnails/40.jpg)
DEMO
Our First Pull Request
![Page 41: Git Fundamentals - pauby.com · Git Fundamentals Open up a world of community and collaboration • Paul Broadwith, Glasgow, Scotland • 25+ years in defence, government, financial](https://reader034.vdocuments.site/reader034/viewer/2022042802/5f37e00bb96db9360d214908/html5/thumbnails/41.jpg)
Git Cycle
Push
Commit
Pull
> git pull > git add .> git commit –m “Initial commit”
> git push
![Page 42: Git Fundamentals - pauby.com · Git Fundamentals Open up a world of community and collaboration • Paul Broadwith, Glasgow, Scotland • 25+ years in defence, government, financial](https://reader034.vdocuments.site/reader034/viewer/2022042802/5f37e00bb96db9360d214908/html5/thumbnails/42.jpg)
Pull Request Flow
master branch
dev branch createdfrom master
commit code
submit pull request
dev branch merged to master
review changes
> git checkout –b dev> git add .> git commit –m “msg”> git push
![Page 43: Git Fundamentals - pauby.com · Git Fundamentals Open up a world of community and collaboration • Paul Broadwith, Glasgow, Scotland • 25+ years in defence, government, financial](https://reader034.vdocuments.site/reader034/viewer/2022042802/5f37e00bb96db9360d214908/html5/thumbnails/43.jpg)
![Page 44: Git Fundamentals - pauby.com · Git Fundamentals Open up a world of community and collaboration • Paul Broadwith, Glasgow, Scotland • 25+ years in defence, government, financial](https://reader034.vdocuments.site/reader034/viewer/2022042802/5f37e00bb96db9360d214908/html5/thumbnails/44.jpg)
![Page 45: Git Fundamentals - pauby.com · Git Fundamentals Open up a world of community and collaboration • Paul Broadwith, Glasgow, Scotland • 25+ years in defence, government, financial](https://reader034.vdocuments.site/reader034/viewer/2022042802/5f37e00bb96db9360d214908/html5/thumbnails/45.jpg)
Summary
• We learned what Git is and where it came from;
• What tools are needed to work with Git;
• Who is using Git and why I need to use it!
• Fundamental Git commands;
• The three stages of Git;
• What a pull request is, why we use them and how to use it to
work with Open Source projects;
![Page 46: Git Fundamentals - pauby.com · Git Fundamentals Open up a world of community and collaboration • Paul Broadwith, Glasgow, Scotland • 25+ years in defence, government, financial](https://reader034.vdocuments.site/reader034/viewer/2022042802/5f37e00bb96db9360d214908/html5/thumbnails/46.jpg)
Congratulations!
You’re now a git !git
![Page 47: Git Fundamentals - pauby.com · Git Fundamentals Open up a world of community and collaboration • Paul Broadwith, Glasgow, Scotland • 25+ years in defence, government, financial](https://reader034.vdocuments.site/reader034/viewer/2022042802/5f37e00bb96db9360d214908/html5/thumbnails/47.jpg)
Questions?
![Page 48: Git Fundamentals - pauby.com · Git Fundamentals Open up a world of community and collaboration • Paul Broadwith, Glasgow, Scotland • 25+ years in defence, government, financial](https://reader034.vdocuments.site/reader034/viewer/2022042802/5f37e00bb96db9360d214908/html5/thumbnails/48.jpg)
DATA:Scotland
Speaker Scholarship
Inclusion – Diversity – Community
bit.ly/ds-
speaker
![Page 49: Git Fundamentals - pauby.com · Git Fundamentals Open up a world of community and collaboration • Paul Broadwith, Glasgow, Scotland • 25+ years in defence, government, financial](https://reader034.vdocuments.site/reader034/viewer/2022042802/5f37e00bb96db9360d214908/html5/thumbnails/49.jpg)
![Page 50: Git Fundamentals - pauby.com · Git Fundamentals Open up a world of community and collaboration • Paul Broadwith, Glasgow, Scotland • 25+ years in defence, government, financial](https://reader034.vdocuments.site/reader034/viewer/2022042802/5f37e00bb96db9360d214908/html5/thumbnails/50.jpg)
Thank You!
linkedin.com/in/paulbroadwith
pau.by/talksPaul Broadwith
pauby.com
@pauby
github.com/pauby