SlideShare a Scribd company logo
Git from the trenches
git from the trenches
netponto - 2017-10-28
Nuno Caneco
Nuno Caneco
/@nuno.caneco
/nunocaneco
nuno.caneco@gmail.com
Engineering Manager / Cluster Lead
git
Git is a free and open source distributed version control system designed to
handle everything from small to very large projects with speed and efficiency.
https://git-scm.com/
Git (slang)
Git is a term of insult with origins in British English denoting an unpleasant, silly, incompetent, stupid,
annoying, senile, elderly or childish person. (...) Typically a good-natured admonition with a strong
implication of familiarity, git is more severe than twit or idiot but less severe than wanker, arsehole or
twat when offence is intended.
https://en.wikipedia.org/wiki/Git_(slang)
Distributed vs Centralized
Centralized
● Server owns the database
● Workstations have working copies
● Workstations commit to server
● Server is single source of true
commit
get latest version commit
commit
commit
push
pull
Distributed
● No server
● Each workstation has its own database
and working copies
● Workstations commit to self database
● Workstations push and pull commits
between them
workstation3
workstation1 workstation2
workstation1 workstation2 workstation3
server
But we still need servers, so...
commit commit commit
push
pull
workstation1 workstation2 workstation3
origin
What's a git commit?
metadata
commit message
content (diff)
git commit ID
SHA-1
● Metadata
○ Commit message
○ Commit date
○ Committer
○ Author date
○ Author
● Content
○ Tree (the diff)
○ Parent commits
Writing good commit messages
Add missing calls to open connection to database
When using Database.CreateConnection() method, the connection is not
opened by default. So, a call to .Open() was being required before using
the connection retrieved.
This commit adds the missing calls to the .Open() method on the UsersDB
class.
Issue #287
GitHub links both ways:
Commit → Issue
Issue → Commit
Start with a verb; use imperative tense.
60 chars max
https://git-scm.com/book/en/v2/Distributed-Git-Contributing-to-a-Project
Staging area
git basic commands
git clone - Clones a repository to a new directory
git checkout - Switch branches or restore working tree files
git checkout -b <BRANCH> - Create a new branch and switch to it
git add <FILE> - Adds changes in <FILE> to the staging area
git commit - Commits the changes in the staging area
git push - Sends the current branch to a remote repository
git pull - Gets changes from a remote repository
DEMO - Basics
Tags and branches
Tags and Branches are pointers to a commit
These pointers can be changed over time
Branch feature1 → C4
Tag v1 → C2
Detached commit
master → C6
v2 → C6
Start with master branch
feature1
Branch per feature
Create a branch to implement a feature
Integrate the feature to master branch
master
master
master
master
Integrating a feature branch
Several strategies can be applied:
● Merge only
● Rebase and merge
● Squash and merge
DEMO
WARNING:
There are different opinions on the branch integration strategy among
the community.
You should discuss the approach with the Team to come up whatever
you feel comfortable with.
History
Merge and merge Rebase and merge
DEMO
Resolving Conflicts
Interactive Rebase
git rebase -i
Allows you to go back and edit the history
DEMO
Keeping history clean
● It's OK to rewrite history feature branches
○ This will ensure a clean history
● Make sure to protect branches that should
not be changed
○ master
○ Environment branches: production / QA
○ Release branches
Some more fun stuff you
can do
git cherry-pick
git cherry-pick <COMMIT ID>
Apply the changes introduced by some existing commits
DEMO
git blame
Show what revision and author last modified each line of a file
Important to track down changes and troubleshooting
WARNING:
The merge strategy can make your life a bit harder to use blame,
because the last edit of a line might be a merge commit, which you
need to follow to find the original commit that introduced that change.
This is one argument in favour of the merge-rebase strategy
git reflog - your safety net
git reflog
Reflog tracks every change on the local repository.
It's possible to git checkout to any commit on the reflog.
git bisect
Use binary search to find the commit that introduced a bug
✘✔
The bug was introduced by one of these commits
✔ ✘✔
DEMO
git hooks
Allows you to customize git behavior
λ ls .git/hooks
applypatch-msg.sample
commit-msg.sample
post-update.sample
pre-applypatch.sample
pre-commit.sample
pre-push.sample
pre-rebase.sample
pre-receive.sample
prepare-commit-msg.sample
update.sample
Git from the trenches
/@nuno.caneco
/nunocaneco
nuno.caneco@gmail.com
Git from the trenches
Git from the trenches
Git from the trenches
Git from the trenches
Git from the trenches

More Related Content

What's hot (20)

Gerrit Code Review with GitHub plugin
Gerrit Code Review with GitHub pluginGerrit Code Review with GitHub plugin
Gerrit Code Review with GitHub plugin
Luca Milanesio
 
Enabling GitOps - Architecture for Implementation
Enabling GitOps - Architecture for ImplementationEnabling GitOps - Architecture for Implementation
Enabling GitOps - Architecture for Implementation
Huynh Thai Bao
 
Git Tricks
Git TricksGit Tricks
Git Tricks
Ivelina Dimova
 
Git & Github
Git & GithubGit & Github
Git & Github
Aman Lalpuria
 
Gitops: the kubernetes way
Gitops: the kubernetes wayGitops: the kubernetes way
Gitops: the kubernetes way
sparkfabrik
 
DevOps Fest 2020. Дмитрий Кудрявцев. Реализация GitOps на Kubernetes. ArgoCD
DevOps Fest 2020. Дмитрий Кудрявцев. Реализация GitOps на Kubernetes. ArgoCDDevOps Fest 2020. Дмитрий Кудрявцев. Реализация GitOps на Kubernetes. ArgoCD
DevOps Fest 2020. Дмитрий Кудрявцев. Реализация GitOps на Kubernetes. ArgoCD
DevOps_Fest
 
Git Series. Episode 2. Merge, Upstream Commands and Tags
Git Series. Episode 2. Merge, Upstream Commands and TagsGit Series. Episode 2. Merge, Upstream Commands and Tags
Git Series. Episode 2. Merge, Upstream Commands and Tags
Mikhail Melnik
 
Git undo
Git undoGit undo
Git undo
Avilay Parekh
 
Git & GitLab
Git & GitLabGit & GitLab
Git & GitLab
Gaurav Wable
 
Git
GitGit
Git
Majid Hajiloo
 
Git and github fundamentals
Git and github fundamentalsGit and github fundamentals
Git and github fundamentals
RajKharvar
 
Git & GitHub
Git & GitHubGit & GitHub
Git & GitHub
Cuong Ngo
 
GitOps: Git come unica fonte di verità per applicazioni e infrastruttura
GitOps: Git come unica fonte di verità per applicazioni e infrastrutturaGitOps: Git come unica fonte di verità per applicazioni e infrastruttura
GitOps: Git come unica fonte di verità per applicazioni e infrastruttura
sparkfabrik
 
CI:CD in Lightspeed with kubernetes and argo cd
CI:CD in Lightspeed with kubernetes and argo cdCI:CD in Lightspeed with kubernetes and argo cd
CI:CD in Lightspeed with kubernetes and argo cd
Billy Yuen
 
CICD pipelines with GitOps
CICD pipelines with GitOpsCICD pipelines with GitOps
CICD pipelines with GitOps
Huynh Thai Bao
 
Speeding up your team with GitOps
Speeding up your team with GitOpsSpeeding up your team with GitOps
Speeding up your team with GitOps
Brice Fernandes
 
Git overview
Git overviewGit overview
Git overview
Gowarthini
 
GitOps Toolkit (Cloud Native Nordics Tech Talk)
GitOps Toolkit (Cloud Native Nordics Tech Talk)GitOps Toolkit (Cloud Native Nordics Tech Talk)
GitOps Toolkit (Cloud Native Nordics Tech Talk)
Weaveworks
 
Continuous Integration/Deployment with Gitlab CI
Continuous Integration/Deployment with Gitlab CIContinuous Integration/Deployment with Gitlab CI
Continuous Integration/Deployment with Gitlab CI
David Hahn
 
A GitOps Kubernetes Native CICD Solution with Argo Events, Workflows, and CD
A GitOps Kubernetes Native CICD Solution with Argo Events, Workflows, and CDA GitOps Kubernetes Native CICD Solution with Argo Events, Workflows, and CD
A GitOps Kubernetes Native CICD Solution with Argo Events, Workflows, and CD
Julian Mazzitelli
 
Gerrit Code Review with GitHub plugin
Gerrit Code Review with GitHub pluginGerrit Code Review with GitHub plugin
Gerrit Code Review with GitHub plugin
Luca Milanesio
 
Enabling GitOps - Architecture for Implementation
Enabling GitOps - Architecture for ImplementationEnabling GitOps - Architecture for Implementation
Enabling GitOps - Architecture for Implementation
Huynh Thai Bao
 
Gitops: the kubernetes way
Gitops: the kubernetes wayGitops: the kubernetes way
Gitops: the kubernetes way
sparkfabrik
 
DevOps Fest 2020. Дмитрий Кудрявцев. Реализация GitOps на Kubernetes. ArgoCD
DevOps Fest 2020. Дмитрий Кудрявцев. Реализация GitOps на Kubernetes. ArgoCDDevOps Fest 2020. Дмитрий Кудрявцев. Реализация GitOps на Kubernetes. ArgoCD
DevOps Fest 2020. Дмитрий Кудрявцев. Реализация GitOps на Kubernetes. ArgoCD
DevOps_Fest
 
Git Series. Episode 2. Merge, Upstream Commands and Tags
Git Series. Episode 2. Merge, Upstream Commands and TagsGit Series. Episode 2. Merge, Upstream Commands and Tags
Git Series. Episode 2. Merge, Upstream Commands and Tags
Mikhail Melnik
 
Git and github fundamentals
Git and github fundamentalsGit and github fundamentals
Git and github fundamentals
RajKharvar
 
Git & GitHub
Git & GitHubGit & GitHub
Git & GitHub
Cuong Ngo
 
GitOps: Git come unica fonte di verità per applicazioni e infrastruttura
GitOps: Git come unica fonte di verità per applicazioni e infrastrutturaGitOps: Git come unica fonte di verità per applicazioni e infrastruttura
GitOps: Git come unica fonte di verità per applicazioni e infrastruttura
sparkfabrik
 
CI:CD in Lightspeed with kubernetes and argo cd
CI:CD in Lightspeed with kubernetes and argo cdCI:CD in Lightspeed with kubernetes and argo cd
CI:CD in Lightspeed with kubernetes and argo cd
Billy Yuen
 
CICD pipelines with GitOps
CICD pipelines with GitOpsCICD pipelines with GitOps
CICD pipelines with GitOps
Huynh Thai Bao
 
Speeding up your team with GitOps
Speeding up your team with GitOpsSpeeding up your team with GitOps
Speeding up your team with GitOps
Brice Fernandes
 
GitOps Toolkit (Cloud Native Nordics Tech Talk)
GitOps Toolkit (Cloud Native Nordics Tech Talk)GitOps Toolkit (Cloud Native Nordics Tech Talk)
GitOps Toolkit (Cloud Native Nordics Tech Talk)
Weaveworks
 
Continuous Integration/Deployment with Gitlab CI
Continuous Integration/Deployment with Gitlab CIContinuous Integration/Deployment with Gitlab CI
Continuous Integration/Deployment with Gitlab CI
David Hahn
 
A GitOps Kubernetes Native CICD Solution with Argo Events, Workflows, and CD
A GitOps Kubernetes Native CICD Solution with Argo Events, Workflows, and CDA GitOps Kubernetes Native CICD Solution with Argo Events, Workflows, and CD
A GitOps Kubernetes Native CICD Solution with Argo Events, Workflows, and CD
Julian Mazzitelli
 

Similar to Git from the trenches (20)

Collaborative development with Git | Workshop
Collaborative development with Git | WorkshopCollaborative development with Git | Workshop
Collaborative development with Git | Workshop
Anuchit Chalothorn
 
3 Git
3 Git3 Git
3 Git
Fabio Fumarola
 
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
 
Introducing Git and git flow
Introducing Git and git flow Introducing Git and git flow
Introducing Git and git flow
Sebin Benjamin
 
git github PPT_GDSCIIITK.pptx
git github PPT_GDSCIIITK.pptxgit github PPT_GDSCIIITK.pptx
git github PPT_GDSCIIITK.pptx
AbelPhilipJoseph
 
Git tutorial
Git tutorialGit tutorial
Git tutorial
mobaires
 
Git and github - Verson Control for the Modern Developer
Git and github - Verson Control for the Modern DeveloperGit and github - Verson Control for the Modern Developer
Git and github - Verson Control for the Modern Developer
John Stevenson
 
Version Control Systems Software Engineering
Version Control Systems Software EngineeringVersion Control Systems Software Engineering
Version Control Systems Software Engineering
ssuser1c86e3
 
Hacktoberfest intro to Git and GitHub
Hacktoberfest intro to Git and GitHubHacktoberfest intro to Git and GitHub
Hacktoberfest intro to Git and GitHub
DSC GVP
 
Git cheat sheet
Git cheat sheetGit cheat sheet
Git cheat sheet
Lam Hoang
 
Git github
Git githubGit github
Git github
Anurag Deb
 
Mini-training: Let’s Git It!
Mini-training: Let’s Git It!Mini-training: Let’s Git It!
Mini-training: Let’s Git It!
Betclic Everest Group Tech Team
 
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 hub abduallah abu nada
Git hub   abduallah abu nadaGit hub   abduallah abu nada
Git hub abduallah abu nada
Lama K Banna
 
tech winter break workshop on git &git hub.pptx
tech winter break workshop on git &git hub.pptxtech winter break workshop on git &git hub.pptx
tech winter break workshop on git &git hub.pptx
ashishraulin
 
Version Control System-git status,git add,git commit,git log.pptx
Version Control System-git status,git add,git commit,git log.pptxVersion Control System-git status,git add,git commit,git log.pptx
Version Control System-git status,git add,git commit,git log.pptx
ChayapathiAR
 
Git Session 2K23.pptx
Git Session 2K23.pptxGit Session 2K23.pptx
Git Session 2K23.pptx
Eshaan35
 
Git essential training & sharing self
Git essential training & sharing selfGit essential training & sharing self
Git essential training & sharing self
Chen-Tien Tsai
 
Git 101 Workshop
Git 101 WorkshopGit 101 Workshop
Git 101 Workshop
Joy Seng
 
Git Basics
Git BasicsGit Basics
Git Basics
Ryan Condron
 
Collaborative development with Git | Workshop
Collaborative development with Git | WorkshopCollaborative development with Git | Workshop
Collaborative development with Git | Workshop
Anuchit Chalothorn
 
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
 
Introducing Git and git flow
Introducing Git and git flow Introducing Git and git flow
Introducing Git and git flow
Sebin Benjamin
 
git github PPT_GDSCIIITK.pptx
git github PPT_GDSCIIITK.pptxgit github PPT_GDSCIIITK.pptx
git github PPT_GDSCIIITK.pptx
AbelPhilipJoseph
 
Git tutorial
Git tutorialGit tutorial
Git tutorial
mobaires
 
Git and github - Verson Control for the Modern Developer
Git and github - Verson Control for the Modern DeveloperGit and github - Verson Control for the Modern Developer
Git and github - Verson Control for the Modern Developer
John Stevenson
 
Version Control Systems Software Engineering
Version Control Systems Software EngineeringVersion Control Systems Software Engineering
Version Control Systems Software Engineering
ssuser1c86e3
 
Hacktoberfest intro to Git and GitHub
Hacktoberfest intro to Git and GitHubHacktoberfest intro to Git and GitHub
Hacktoberfest intro to Git and GitHub
DSC GVP
 
Git cheat sheet
Git cheat sheetGit cheat sheet
Git cheat sheet
Lam Hoang
 
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 hub abduallah abu nada
Git hub   abduallah abu nadaGit hub   abduallah abu nada
Git hub abduallah abu nada
Lama K Banna
 
tech winter break workshop on git &git hub.pptx
tech winter break workshop on git &git hub.pptxtech winter break workshop on git &git hub.pptx
tech winter break workshop on git &git hub.pptx
ashishraulin
 
Version Control System-git status,git add,git commit,git log.pptx
Version Control System-git status,git add,git commit,git log.pptxVersion Control System-git status,git add,git commit,git log.pptx
Version Control System-git status,git add,git commit,git log.pptx
ChayapathiAR
 
Git Session 2K23.pptx
Git Session 2K23.pptxGit Session 2K23.pptx
Git Session 2K23.pptx
Eshaan35
 
Git essential training & sharing self
Git essential training & sharing selfGit essential training & sharing self
Git essential training & sharing self
Chen-Tien Tsai
 
Git 101 Workshop
Git 101 WorkshopGit 101 Workshop
Git 101 Workshop
Joy Seng
 

More from Nuno Caneco (8)

Building resilient applications
Building resilient applicationsBuilding resilient applications
Building resilient applications
Nuno Caneco
 
Stateful mock servers to the rescue on REST ecosystems
Stateful mock servers to the rescue on REST ecosystemsStateful mock servers to the rescue on REST ecosystems
Stateful mock servers to the rescue on REST ecosystems
Nuno Caneco
 
Tuga IT 2017 - Redis
Tuga IT 2017 - RedisTuga IT 2017 - Redis
Tuga IT 2017 - Redis
Nuno Caneco
 
Tuga it 2017 - Event processing with Apache Storm
Tuga it 2017 - Event processing with Apache StormTuga it 2017 - Event processing with Apache Storm
Tuga it 2017 - Event processing with Apache Storm
Nuno Caneco
 
Fullstack LX - Improving your application performance
Fullstack LX - Improving your application performanceFullstack LX - Improving your application performance
Fullstack LX - Improving your application performance
Nuno Caneco
 
Running agile on a non-agile environment
Running agile on a non-agile environmentRunning agile on a non-agile environment
Running agile on a non-agile environment
Nuno Caneco
 
Introducing redis
Introducing redisIntroducing redis
Introducing redis
Nuno Caneco
 
Tuga it 2016 improving your application performance
Tuga it 2016   improving your application performanceTuga it 2016   improving your application performance
Tuga it 2016 improving your application performance
Nuno Caneco
 
Building resilient applications
Building resilient applicationsBuilding resilient applications
Building resilient applications
Nuno Caneco
 
Stateful mock servers to the rescue on REST ecosystems
Stateful mock servers to the rescue on REST ecosystemsStateful mock servers to the rescue on REST ecosystems
Stateful mock servers to the rescue on REST ecosystems
Nuno Caneco
 
Tuga IT 2017 - Redis
Tuga IT 2017 - RedisTuga IT 2017 - Redis
Tuga IT 2017 - Redis
Nuno Caneco
 
Tuga it 2017 - Event processing with Apache Storm
Tuga it 2017 - Event processing with Apache StormTuga it 2017 - Event processing with Apache Storm
Tuga it 2017 - Event processing with Apache Storm
Nuno Caneco
 
Fullstack LX - Improving your application performance
Fullstack LX - Improving your application performanceFullstack LX - Improving your application performance
Fullstack LX - Improving your application performance
Nuno Caneco
 
Running agile on a non-agile environment
Running agile on a non-agile environmentRunning agile on a non-agile environment
Running agile on a non-agile environment
Nuno Caneco
 
Introducing redis
Introducing redisIntroducing redis
Introducing redis
Nuno Caneco
 
Tuga it 2016 improving your application performance
Tuga it 2016   improving your application performanceTuga it 2016   improving your application performance
Tuga it 2016 improving your application performance
Nuno Caneco
 

Recently uploaded (20)

How can one start with crypto wallet development.pptx
How can one start with crypto wallet development.pptxHow can one start with crypto wallet development.pptx
How can one start with crypto wallet development.pptx
laravinson24
 
Secure Test Infrastructure: The Backbone of Trustworthy Software Development
Secure Test Infrastructure: The Backbone of Trustworthy Software DevelopmentSecure Test Infrastructure: The Backbone of Trustworthy Software Development
Secure Test Infrastructure: The Backbone of Trustworthy Software Development
Shubham Joshi
 
Meet the Agents: How AI Is Learning to Think, Plan, and Collaborate
Meet the Agents: How AI Is Learning to Think, Plan, and CollaborateMeet the Agents: How AI Is Learning to Think, Plan, and Collaborate
Meet the Agents: How AI Is Learning to Think, Plan, and Collaborate
Maxim Salnikov
 
Revolutionizing Residential Wi-Fi PPT.pptx
Revolutionizing Residential Wi-Fi PPT.pptxRevolutionizing Residential Wi-Fi PPT.pptx
Revolutionizing Residential Wi-Fi PPT.pptx
nidhisingh691197
 
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
 
How to Batch Export Lotus Notes NSF Emails to Outlook PST Easily?
How to Batch Export Lotus Notes NSF Emails to Outlook PST Easily?How to Batch Export Lotus Notes NSF Emails to Outlook PST Easily?
How to Batch Export Lotus Notes NSF Emails to Outlook PST Easily?
steaveroggers
 
Solidworks Crack 2025 latest new + license code
Solidworks Crack 2025 latest new + license codeSolidworks Crack 2025 latest new + license code
Solidworks Crack 2025 latest new + license code
aneelaramzan63
 
Exploring Code Comprehension in Scientific Programming: Preliminary Insight...
Exploring Code Comprehension  in Scientific Programming:  Preliminary Insight...Exploring Code Comprehension  in Scientific Programming:  Preliminary Insight...
Exploring Code Comprehension in Scientific Programming: Preliminary Insight...
University of Hawai‘i at Mānoa
 
Not So Common Memory Leaks in Java Webinar
Not So Common Memory Leaks in Java WebinarNot So Common Memory Leaks in Java Webinar
Not So Common Memory Leaks in Java Webinar
Tier1 app
 
Why Orangescrum Is a Game Changer for Construction Companies in 2025
Why Orangescrum Is a Game Changer for Construction Companies in 2025Why Orangescrum Is a Game Changer for Construction Companies in 2025
Why Orangescrum Is a Game Changer for Construction Companies in 2025
Orangescrum
 
FL Studio Producer Edition Crack 2025 Full Version
FL Studio Producer Edition Crack 2025 Full VersionFL Studio Producer Edition Crack 2025 Full Version
FL Studio Producer Edition Crack 2025 Full Version
tahirabibi60507
 
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
 
EASEUS Partition Master Crack + License Code
EASEUS Partition Master Crack + License CodeEASEUS Partition Master Crack + License Code
EASEUS Partition Master Crack + License Code
aneelaramzan63
 
Proactive Vulnerability Detection in Source Code Using Graph Neural Networks:...
Proactive Vulnerability Detection in Source Code Using Graph Neural Networks:...Proactive Vulnerability Detection in Source Code Using Graph Neural Networks:...
Proactive Vulnerability Detection in Source Code Using Graph Neural Networks:...
Ranjan Baisak
 
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
 
Douwan Crack 2025 new verson+ License code
Douwan Crack 2025 new verson+ License codeDouwan Crack 2025 new verson+ License code
Douwan Crack 2025 new verson+ License code
aneelaramzan63
 
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
 
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
 
How to Optimize Your AWS Environment for Improved Cloud Performance
How to Optimize Your AWS Environment for Improved Cloud PerformanceHow to Optimize Your AWS Environment for Improved Cloud Performance
How to Optimize Your AWS Environment for Improved Cloud Performance
ThousandEyes
 
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
 
How can one start with crypto wallet development.pptx
How can one start with crypto wallet development.pptxHow can one start with crypto wallet development.pptx
How can one start with crypto wallet development.pptx
laravinson24
 
Secure Test Infrastructure: The Backbone of Trustworthy Software Development
Secure Test Infrastructure: The Backbone of Trustworthy Software DevelopmentSecure Test Infrastructure: The Backbone of Trustworthy Software Development
Secure Test Infrastructure: The Backbone of Trustworthy Software Development
Shubham Joshi
 
Meet the Agents: How AI Is Learning to Think, Plan, and Collaborate
Meet the Agents: How AI Is Learning to Think, Plan, and CollaborateMeet the Agents: How AI Is Learning to Think, Plan, and Collaborate
Meet the Agents: How AI Is Learning to Think, Plan, and Collaborate
Maxim Salnikov
 
Revolutionizing Residential Wi-Fi PPT.pptx
Revolutionizing Residential Wi-Fi PPT.pptxRevolutionizing Residential Wi-Fi PPT.pptx
Revolutionizing Residential Wi-Fi PPT.pptx
nidhisingh691197
 
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
 
How to Batch Export Lotus Notes NSF Emails to Outlook PST Easily?
How to Batch Export Lotus Notes NSF Emails to Outlook PST Easily?How to Batch Export Lotus Notes NSF Emails to Outlook PST Easily?
How to Batch Export Lotus Notes NSF Emails to Outlook PST Easily?
steaveroggers
 
Solidworks Crack 2025 latest new + license code
Solidworks Crack 2025 latest new + license codeSolidworks Crack 2025 latest new + license code
Solidworks Crack 2025 latest new + license code
aneelaramzan63
 
Exploring Code Comprehension in Scientific Programming: Preliminary Insight...
Exploring Code Comprehension  in Scientific Programming:  Preliminary Insight...Exploring Code Comprehension  in Scientific Programming:  Preliminary Insight...
Exploring Code Comprehension in Scientific Programming: Preliminary Insight...
University of Hawai‘i at Mānoa
 
Not So Common Memory Leaks in Java Webinar
Not So Common Memory Leaks in Java WebinarNot So Common Memory Leaks in Java Webinar
Not So Common Memory Leaks in Java Webinar
Tier1 app
 
Why Orangescrum Is a Game Changer for Construction Companies in 2025
Why Orangescrum Is a Game Changer for Construction Companies in 2025Why Orangescrum Is a Game Changer for Construction Companies in 2025
Why Orangescrum Is a Game Changer for Construction Companies in 2025
Orangescrum
 
FL Studio Producer Edition Crack 2025 Full Version
FL Studio Producer Edition Crack 2025 Full VersionFL Studio Producer Edition Crack 2025 Full Version
FL Studio Producer Edition Crack 2025 Full Version
tahirabibi60507
 
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
 
EASEUS Partition Master Crack + License Code
EASEUS Partition Master Crack + License CodeEASEUS Partition Master Crack + License Code
EASEUS Partition Master Crack + License Code
aneelaramzan63
 
Proactive Vulnerability Detection in Source Code Using Graph Neural Networks:...
Proactive Vulnerability Detection in Source Code Using Graph Neural Networks:...Proactive Vulnerability Detection in Source Code Using Graph Neural Networks:...
Proactive Vulnerability Detection in Source Code Using Graph Neural Networks:...
Ranjan Baisak
 
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
 
Douwan Crack 2025 new verson+ License code
Douwan Crack 2025 new verson+ License codeDouwan Crack 2025 new verson+ License code
Douwan Crack 2025 new verson+ License code
aneelaramzan63
 
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
 
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
 
How to Optimize Your AWS Environment for Improved Cloud Performance
How to Optimize Your AWS Environment for Improved Cloud PerformanceHow to Optimize Your AWS Environment for Improved Cloud Performance
How to Optimize Your AWS Environment for Improved Cloud Performance
ThousandEyes
 
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
 

Git from the trenches

  • 2. git from the trenches netponto - 2017-10-28 Nuno Caneco
  • 4. git Git is a free and open source distributed version control system designed to handle everything from small to very large projects with speed and efficiency. https://git-scm.com/ Git (slang) Git is a term of insult with origins in British English denoting an unpleasant, silly, incompetent, stupid, annoying, senile, elderly or childish person. (...) Typically a good-natured admonition with a strong implication of familiarity, git is more severe than twit or idiot but less severe than wanker, arsehole or twat when offence is intended. https://en.wikipedia.org/wiki/Git_(slang)
  • 5. Distributed vs Centralized Centralized ● Server owns the database ● Workstations have working copies ● Workstations commit to server ● Server is single source of true commit get latest version commit commit commit push pull Distributed ● No server ● Each workstation has its own database and working copies ● Workstations commit to self database ● Workstations push and pull commits between them workstation3 workstation1 workstation2 workstation1 workstation2 workstation3 server
  • 6. But we still need servers, so... commit commit commit push pull workstation1 workstation2 workstation3 origin
  • 7. What's a git commit? metadata commit message content (diff)
  • 8. git commit ID SHA-1 ● Metadata ○ Commit message ○ Commit date ○ Committer ○ Author date ○ Author ● Content ○ Tree (the diff) ○ Parent commits
  • 9. Writing good commit messages Add missing calls to open connection to database When using Database.CreateConnection() method, the connection is not opened by default. So, a call to .Open() was being required before using the connection retrieved. This commit adds the missing calls to the .Open() method on the UsersDB class. Issue #287 GitHub links both ways: Commit → Issue Issue → Commit Start with a verb; use imperative tense. 60 chars max https://git-scm.com/book/en/v2/Distributed-Git-Contributing-to-a-Project
  • 11. git basic commands git clone - Clones a repository to a new directory git checkout - Switch branches or restore working tree files git checkout -b <BRANCH> - Create a new branch and switch to it git add <FILE> - Adds changes in <FILE> to the staging area git commit - Commits the changes in the staging area git push - Sends the current branch to a remote repository git pull - Gets changes from a remote repository
  • 13. Tags and branches Tags and Branches are pointers to a commit These pointers can be changed over time Branch feature1 → C4 Tag v1 → C2 Detached commit master → C6 v2 → C6
  • 14. Start with master branch feature1 Branch per feature Create a branch to implement a feature Integrate the feature to master branch master master master master
  • 15. Integrating a feature branch Several strategies can be applied: ● Merge only ● Rebase and merge ● Squash and merge DEMO WARNING: There are different opinions on the branch integration strategy among the community. You should discuss the approach with the Team to come up whatever you feel comfortable with.
  • 16. History Merge and merge Rebase and merge
  • 18. Interactive Rebase git rebase -i Allows you to go back and edit the history DEMO
  • 19. Keeping history clean ● It's OK to rewrite history feature branches ○ This will ensure a clean history ● Make sure to protect branches that should not be changed ○ master ○ Environment branches: production / QA ○ Release branches
  • 20. Some more fun stuff you can do
  • 21. git cherry-pick git cherry-pick <COMMIT ID> Apply the changes introduced by some existing commits DEMO
  • 22. git blame Show what revision and author last modified each line of a file Important to track down changes and troubleshooting WARNING: The merge strategy can make your life a bit harder to use blame, because the last edit of a line might be a merge commit, which you need to follow to find the original commit that introduced that change. This is one argument in favour of the merge-rebase strategy
  • 23. git reflog - your safety net git reflog Reflog tracks every change on the local repository. It's possible to git checkout to any commit on the reflog.
  • 24. git bisect Use binary search to find the commit that introduced a bug ✘✔ The bug was introduced by one of these commits ✔ ✘✔ DEMO
  • 25. git hooks Allows you to customize git behavior λ ls .git/hooks applypatch-msg.sample commit-msg.sample post-update.sample pre-applypatch.sample pre-commit.sample pre-push.sample pre-rebase.sample pre-receive.sample prepare-commit-msg.sample update.sample