SlideShare a Scribd company logo
1 of 100
Download to read offline
Branch in Time
A story about revision histories
@tekin
Docs-R-UsSeema
Seema Docs-R-Us
class PatientsController < ApplicationController
before_action :load_doctor
def index
@patients = sorted_patients
end
def show
@patient = @doctor.patients.find(params[:id])
end
private
def sorted_patients
@doctor.patients.sort { |patient| patient.name }
end
def load_doctor
@doctor = doctor_from_current_session
class PatientsController < ApplicationController
before_action :load_doctor
def index
@patients = sorted_patients
end
def show
@patient = @doctor.patients.find(params[:id])
end
private
def sorted_patients
@doctor.patients.sort { |patient| patient.name }
end
def load_doctor
@doctor = doctor_from_current_session
class PatientsController < ApplicationController
before_action :load_doctor
def index
@patients = sorted_patients
end
def show
@patient = @doctor.patients.find(params[:id])
end
private
def sorted_patients
@doctor.patients.order(:name)
end
def load_doctor
@doctor = doctor_from_current_session
class PatientsController < ApplicationController
before_action :load_doctor
def index
@patients = sorted_patients
end
def show
@patient = @doctor.patients.find(params[:id])
end
private
def sorted_patients
@doctor.patients.order(:name)
end
def load_doctor
@doctor = doctor_from_current_session
$ rake
Run options: --seed 45260
# Running:
....................................................................
....................................................................
....................................................................
....................................
Finished in 123.299088s, 23.8629 runs/s, 34.6397 assertions/s.
3311 runs, 45124 assertions, 0 failures, 0 errors, 0 skips
class Patient < ApplicationRecord
has_many :appointments
validates_presence_of :name, :address, :date_of_birth
end
class Doctor < ApplicationRecord
has_many :appointments
has_many :patients, through: :appointments
belongs_to :practice
validates_presence_of :name, :practice
end
Git Fu
1. git blame
$ git blame app/controllers/patients_controller.rb
Git Fu: git blame
3fc122c2 (Richard E 2010-06-28 17:02:54 +0100 1) # Controller for listing a doctor's pa
3fc122c2 (Richard E 2010-06-28 17:02:54 +0100 2) class PatientsController < Application
3fc122c2 (Richard E 2010-06-28 17:02:54 +0100 3) before_filter :load_doctor
3fc122c2 (Richard E 2010-06-28 17:02:54 +0100 4)
3fc122c2 (Richard E 2010-06-28 17:02:54 +0100 5) def index
6047246d (Josie P 2010-10-29 09:32:25 +0100 6) @patients = sorted_patients
3fc122c2 (Richard E 2010-06-28 17:02:54 +0100 7) end
3fc122c2 (Richard E 2010-06-28 17:02:54 +0100 8)
9598514f (Josie P 2010-06-28 17:03:21 +0100 9) def show
9598514f (Josie P 2010-06-28 17:03:21 +0100 10) @patient = @doctor.patients.find(p
9598514f (Josie P 2010-06-28 17:03:21 +0100 11) end
9598514f (Richard E 2010-06-28 17:03:21 +0100 12)
3fc122c2 (Richard E 2010-06-28 17:02:54 +0100 13) private
dbdd0fb9 (Josie P 2010-10-29 09:31:52 +0100 18)
6047246d (Josie P 2010-10-29 09:32:25 +0100 19) def sorted_patients
dbdd0fb9 (Josie P 2010-10-29 09:31:52 +0100 20) @doctor.patients.sort {|patient| p
dbdd0f69 (Josie P 2010-10-29 09:31:52 +0100 21) end
3fc122c2 (Richard E 2010-06-28 17:02:54 +0100 14)
$ git blame app/controllers/patients_controller.rb
Git Fu: git blame
--patch
Git Fu: git blame
$ git log dbdd0fb9
$ git log dbdd0fb9 --patch
commit dbdd0fb9e870b91e6925903553f07df3becc9414
Author: Josie Pickford<josie@docs-r-us.com>
Date: Fri Oct 29 09:31:52 2010 +0100
PR Feedback: Fixed a typo
diff --git a/app/controllers/patients_controller.rb b/app/controllers/patients_controller
index d7c6df5..1e3debb 100644
--- a/app/controllers/patients_controller.rb
+++ b/app/controllers/patients_controller.rb
@@ -13,7 +13,7 @@ class PatientsController < ApplicationController
private
def sorted_patients
- @doctor.patients.sort {|pateint| pateint.name }
+ @doctor.patients.sort {|patient| patient.name }
end
Git Fu: git blame
Git Fu
1. git blame
2. git log -S (AKA The Pickaxe)
Git Fu: git log -S (AKA The Pickaxe)
$ git log -S "sorted_patients" --patch --reverse
Git Fu: git log -S (AKA The Pickaxe)
$ git log -S "sorted_patients" --patch --reverse
commit 23b6e0c6a9a7a392c312d4f0c51153e0769ebffc
Author: Josie Pickford<josie@docs-r-us.com>
Date: Thurs Oct 28 17:55:32 2010 +0100
Rename method
diff --git a/app/controllers/patients_controller.rb b/app/controllers/
patients_controller.rb
index 51fbd8a..d7c6df5 100644
--- a/app/controllers/patients_controller.rb
+++ b/app/controllers/patients_controller.rb
@@ -3,7 +3,7 @@ class PatientsController < ApplicationController
before_filter :load_doctor
def index
- @patients = load_patients
+ @patients = sorted_patients
end
Git Fu
1. git blame
2. git log -S (AKA The Pickaxe)
3. Pickaxe Round 2
Git Fu: Pickaxe Round 2
$ git log -S "load_patients" --patch --reverse
commit 66f95816017b1c6582034d074333fa18884ad3c3
Author: Josie Pickford<josie@docs-r-us.com>
Date: Thurs Oct 28 17:00:43 2010 +0100
Fix patient ordering bug
diff --git a/app/controllers/patients_controller.rb b/app/controllers/patients_controller
index cb0e69c..51fbd8a 100644
--- a/app/controllers/patients_controller.rb
+++ b/app/controllers/patients_controller.rb
@@ -3,7 +3,7 @@ class PatientsController < ApplicationController
before_filter :load_doctor
def index
- @patients = @doctor.patients.order(:name)
+ @patients = load_patients
end
Git Fu
1. git blame
2. git log -S (AKA The Pickaxe)
3. Pickaxe Round 2
4. Find the Pull Request
Git Fu: Find the Pull Request
Git Fu: Find the Pull Request
Git Fu: Find the Pull Request
Git Fu: Find the Pull Request
8 years ago...
Docs-R-UsJosie
8 years ago...
Doh!
☕💦
8 years ago...
Josie
Y U NO ALPHABETICAL!?
class PatientsController < ApplicationController
before_filter :load_doctor
def index
@patients = @doctor.patients.order(:name)
end
def show
@patient = @doctor.patients.find(params[:id])
end
private
def load_doctor
@doctor = doctor_from_current_session
end
end
class PatientsController < ApplicationController
before_filter :load_doctor
def index
@patients = @doctor.patients.order(:name)
end
def show
@patient = @doctor.patients.find(params[:id])
end
private
def load_doctor
@doctor = doctor_from_current_session
end
end
class Doctor < ApplicationRecord
has_many :appointments, order: :appointment_date
has_many :patients, through: :appointments
belongs_to :practice
validates_presence_of :name, :practice
end
class Doctor < ApplicationRecord
has_many :appointments, order: :appointment_date
has_many :patients, through: :appointments
belongs_to :practice
validates_presence_of :name, :practice
end
class Doctor < ApplicationRecord
has_many :appointments, order: :appointment_date
has_many :patients, through: :appointments
belongs_to :practice
validates_presence_of :name, :practice
end
doctor.patients.order(:name)
Patients Load (1.0ms) SELECT "patients".* FROM "patients"
INNER JOIN "appointments" ON "patients"."id" = "appointments"."patient_id"
WHERE “appointments"."doctor_id" = $1
ORDER BY “appointments"."appointment_date" ASC, "patients"."name" ASC
irb(main):003:0>
class Doctor < ApplicationRecord
has_many :appointments
has_many :patients, through: :appointments
belongs_to :practice
validates_presence_of :name, :practice
end
, order: :appointment_date
class Doctor < ApplicationRecord
has_many :appointments
has_many :patients, through: :appointments
belongs_to :practice
validates_presence_of :name, :practice
end
$ rake
Run options: --seed 45260
# Running:
.....F..........FFFF.........F..........FF..............FFFFFFFFF...
..............FFFFFFFFFFFFFFFFFF............................FFFF
Finished in 1.273019s, 24.3516 runs/s, 35.3490 assertions/s.
class PatientsController < ApplicationController
before_filter :load_doctor
def index
@patients = @doctor.patients.order(:name)
end
def show
@patient = @doctor.patients.find(params[:id])
end
private
def load_doctor
@doctor = doctor_from_current_session
end
end
class PatientsController < ApplicationController
before_filter :load_doctor
def index
@patients =
end
def show
@patient = @doctor.patients.find(params[:id])
end
private
def load_patients
@doctor.patients.sort { |pateint| pateint.name }
end
def load_doctor
@doctor = doctor_from_current_session
load_patients
Branch history
Pull Request (YOLO)
Build broke...
Build broke...
Just one more commit...
... and another
Ship it!
Intermission
Intermission
No reorder( ) in Rails 2.3.8
Intermission
8 years ago...
Docs-R-Us
8 years ago...
Josie
Damn fine coffee!
8 years ago...
☕Josie
Y U NO ALPHABETICAL!?
Branch history
Branch history
Branch history
Git Fu
1. git rebase --interactive
git rebase --interactive head~3
Git Fu: git rebase --interactive
$
git rebase --interactive head~3
Git Fu: git rebase --interactive
$
git rebase --interactive head~3
Git Fu: git rebase --interactive
$
Git Fu: git rebase --interactive
git rebase --interactive head~3$
Pull Request
Build broke...
Fix the build
git add test/integration
$
$
[fix-patient-order-bug ee74d2f] Fix patient ordering bug
Date: Fri Oct 29 09:36:08 2010 +0100
3 files changed, 44 insertions(+), 3 deletion(-)
$
git commit --amend --no-edit
Fix the build
git push --force-with-lease
git add test/integration
$
$
[fix-patient-order-bug ee74d2f] Fix patient ordering bug
Date: Fri Oct 29 09:36:08 2010 +0100
3 files changed, 44 insertions(+), 3 deletion(-)
$
git commit --amend --no-edit
Ship it!
Back to the
future...
Docs-R-UsSeemaSeema
class PatientsController < ApplicationController
before_action :load_doctor
def index
@patients = sorted_patients
end
def show
@patient = @doctor.patients.find(params[:id])
end
private
def sorted_patients
@doctor.patients.sort { |patient| patient.name }
end
def load_doctor
@doctor = doctor_from_current_session
3fc122c2 (Richard E 2010-06-28 17:02:54 +0100 1) # Controller for listing a doctor's pa
3fc122c2 (Richard E 2010-06-28 17:02:54 +0100 2) class PatientsController < Application
3fc122c2 (Richard E 2010-06-28 17:02:54 +0100 3) before_filter :load_doctor
3fc122c2 (Richard E 2010-06-28 17:02:54 +0100 4)
3fc122c2 (Richard E 2010-06-28 17:02:54 +0100 5) def index
6047246d (Josie P 2010-10-29 09:32:25 +0100 6) @patients = sorted_patients
3fc122c2 (Richard E 2010-06-28 17:02:54 +0100 7) end
3fc122c2 (Richard E 2010-06-28 17:02:54 +0100 8)
9598514f (Josie P 2010-06-28 17:03:21 +0100 9) def show
9598514f (Josie P 2010-06-28 17:03:21 +0100 10) @patient = @doctor.patients.find(p
9598514f (Josie P 2010-06-28 17:03:21 +0100 11) end
9598514f (Richard E 2010-06-28 17:03:21 +0100 12)
3fc122c2 (Richard E 2010-06-28 17:02:54 +0100 13) private
dbdd0fb9 (Josie P 2010-10-29 09:31:52 +0100 18)
6047246d (Josie P 2010-10-29 09:32:25 +0100 19) def sorted_patients
33ec144e (Josie P 2010-10-29 09:31:52 +0100 20) @doctor.patients.sort {|patient| p
dbdd0f69 (Josie P 2010-10-29 09:31:52 +0100 21) end
3fc122c2 (Richard E 2010-06-28 17:02:54 +0100 14)
$ git blame app/controllers/patients_controller.rb
Git Fu: git blame
$ git log 33ec144e --patch
commit 33ec144e70b91e6925903553f07df3becc9414
Author: Josie Pickford<josie@docs-r-us.com>
Date: Friday Oct 29 09:44:49 2010 +0100
Fix patient ordering bug
The patients association is returning patients in appointment date
order, even when called with an explicit `order(:name)` scope. This is
because the patients association is a has_many :through the appointments
association, which has a default order by appointment_date. This causes
any queries on the association to always sort first by appointment date:
ORDER BY “appointments"."appointment_date" ASC, "patients"."name" ASC)
Removing the default ordering from the appointments association is going
to take a bit of unpicking. To get the bug resolved in the meantime we
can re-sort the patient records after they've been loaded. Separate
work has been planned to remove the default ordering altogether.
Git Fu: git blame
class Doctor < ApplicationRecord
has_many :appointments
has_many :patients, through: :appointments
belongs_to :practice
validates_presence_of :name, :practice
end
• Naming things
• Automated tests
• Abstractions
• Refactoring
Your software
is more than
the code
Programming as
Theory Building
Peter Naur
Revision History as
Theory Capturing
Git Fu
1. Configure an environment for good commit
messages
Configure an environment for good commit messages
$ git commit -m "Did a thing"
Configure an environment for good commit messages
$ git config --global core.editor “subl -w”
Configure an environment for good commit messages
$ git config --global commit.verbose true
Git Fu
1. Configure an environment for good commit
messages
2. Capture the why, not the what
Capture the why, not the what
Git Fu
1. Configure an environment for good commit
messages
2. Capture the why, not the what
3. Shape each commit
Shape each commit
• Create small atomic commits
• Shape as you go, not at the end
• $ git add --patch / -p
Shape each commit
dd3b43c Refactor Foo
44b4bd8 Add Bar to Foo
Git Fu
1. Configure an environment for good commit
messages
2. Capture the why, not the what
4. Treat (local) commits as mutable
3. Shape each commit
Treat (local) commits as mutable
• $ git commit --amend
• $ git rebase --interactive
• $ git rebase --abort
• --fixup / --autosquash
Git Fu
1. Configure an environment for good commit
messages
2. Capture the why, not the what
5. Build your instincts; search your histories
4. Treat (local) commits as mutable
3. Shape each commit
Build your instincts; search your histories
• $ git blame file.rb
• $ git log -S "some_code"
• $ git annotate file.rb
Git Fu
1. Configure an environment for good commit
messages
2. Capture the why, not the what
5. Treat (local) commits as mutable
4. Build your instincts; search your histories
3. Shape each commit
tekin.co.uk
Thanks for the Git Fu
@dgheath21@angelajtodd@grahamashton
Help each
other Git
Better
Seema Memoji
Josie Memoji
Created by
Inspiration for the story-based approach
Talk Feedback and Advice
Slide Advisor
Git Fu Indent
Hospital Icon
Winding Road Photo
Sound Effects
TEKIN SULEYMAN
TEKIN SULEYMAN
TEKIN SULEYMAN
NADIA ODUNAYO
ANDY CROLL
ANGELA TODD
GRAHAM ASHTON
MURRAY STEELE
NADIA ODUNAYO
KATRINA OWEN
BRUCE LEE, ENTER THE DRAGON (1972)
FLATICON.COM
JESSE BOWSER ON UNSPLASH
LEGEND OF ZELDA, A LINK TO THE PAST
Cast
Branch in Time
A story about revision histories
@tekin

More Related Content

Similar to Branch in Time (a story about revision histories)

Wait Events 10g
Wait Events 10gWait Events 10g
Wait Events 10g
sagai
 
Creating Applicability Statements that Work!
Creating Applicability Statements that Work!Creating Applicability Statements that Work!
Creating Applicability Statements that Work!
Michael Cook
 
Mining and Untangling Change Genealogies (PhD Defense Talk)
Mining and Untangling Change Genealogies (PhD Defense Talk)Mining and Untangling Change Genealogies (PhD Defense Talk)
Mining and Untangling Change Genealogies (PhD Defense Talk)
Kim Herzig
 
Using Git as your VCS with Bioconductor
Using Git as your VCS with BioconductorUsing Git as your VCS with Bioconductor
Using Git as your VCS with Bioconductor
timyates
 
Building Web Service Clients with ActiveModel
Building Web Service Clients with ActiveModelBuilding Web Service Clients with ActiveModel
Building Web Service Clients with ActiveModel
pauldix
 

Similar to Branch in Time (a story about revision histories) (20)

Ruby on rails
Ruby on rails Ruby on rails
Ruby on rails
 
Reliability and Reslience
Reliability and ReslienceReliability and Reslience
Reliability and Reslience
 
Opportunities to Improve System Reliability and Resilience by Donald Belcham
Opportunities to Improve System Reliability and Resilience by Donald BelchamOpportunities to Improve System Reliability and Resilience by Donald Belcham
Opportunities to Improve System Reliability and Resilience by Donald Belcham
 
Getting started with R when analysing GitHub commits
Getting started with R when analysing GitHub commitsGetting started with R when analysing GitHub commits
Getting started with R when analysing GitHub commits
 
MongoDB .local Toronto 2019: Using Change Streams to Keep Up with Your Data
MongoDB .local Toronto 2019: Using Change Streams to Keep Up with Your DataMongoDB .local Toronto 2019: Using Change Streams to Keep Up with Your Data
MongoDB .local Toronto 2019: Using Change Streams to Keep Up with Your Data
 
Getting started with Content Registration 012617
Getting started with Content Registration 012617Getting started with Content Registration 012617
Getting started with Content Registration 012617
 
Crossref Webinar - Getting Started with Content Registration
Crossref Webinar - Getting Started with Content RegistrationCrossref Webinar - Getting Started with Content Registration
Crossref Webinar - Getting Started with Content Registration
 
getting started with content registration
getting started with content registrationgetting started with content registration
getting started with content registration
 
Transformations - how Oracle rewrites your statements
Transformations - how Oracle rewrites your statementsTransformations - how Oracle rewrites your statements
Transformations - how Oracle rewrites your statements
 
Reliability and Resilience
Reliability and ResilienceReliability and Resilience
Reliability and Resilience
 
Beyond PHP - It's not (just) about the code
Beyond PHP - It's not (just) about the codeBeyond PHP - It's not (just) about the code
Beyond PHP - It's not (just) about the code
 
Supporting Transactions
Supporting TransactionsSupporting Transactions
Supporting Transactions
 
Wait Events 10g
Wait Events 10gWait Events 10g
Wait Events 10g
 
Creating Applicability Statements that Work!
Creating Applicability Statements that Work!Creating Applicability Statements that Work!
Creating Applicability Statements that Work!
 
Troubleshooting PostgreSQL Streaming Replication
Troubleshooting PostgreSQL Streaming ReplicationTroubleshooting PostgreSQL Streaming Replication
Troubleshooting PostgreSQL Streaming Replication
 
Mining and Untangling Change Genealogies (PhD Defense Talk)
Mining and Untangling Change Genealogies (PhD Defense Talk)Mining and Untangling Change Genealogies (PhD Defense Talk)
Mining and Untangling Change Genealogies (PhD Defense Talk)
 
How Instacart’s Catalog Flourished While Hyper-Growing (ANT328-S) - AWS re:In...
How Instacart’s Catalog Flourished While Hyper-Growing (ANT328-S) - AWS re:In...How Instacart’s Catalog Flourished While Hyper-Growing (ANT328-S) - AWS re:In...
How Instacart’s Catalog Flourished While Hyper-Growing (ANT328-S) - AWS re:In...
 
Event sourcing in the functional world (22 07-2021)
Event sourcing in the functional world (22 07-2021)Event sourcing in the functional world (22 07-2021)
Event sourcing in the functional world (22 07-2021)
 
Using Git as your VCS with Bioconductor
Using Git as your VCS with BioconductorUsing Git as your VCS with Bioconductor
Using Git as your VCS with Bioconductor
 
Building Web Service Clients with ActiveModel
Building Web Service Clients with ActiveModelBuilding Web Service Clients with ActiveModel
Building Web Service Clients with ActiveModel
 

Recently uploaded

%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
masabamasaba
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
VishalKumarJha10
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
masabamasaba
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
shinachiaurasa2
 

Recently uploaded (20)

AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
 
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
 
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareAnnouncing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK Software
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
 
Chinsurah Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts ...
Chinsurah Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts ...Chinsurah Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts ...
Chinsurah Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts ...
 
%+27788225528 love spells in Vancouver Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Vancouver Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Vancouver Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Vancouver Psychic Readings, Attraction spells,Br...
 
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
 
Generic or specific? Making sensible software design decisions
Generic or specific? Making sensible software design decisionsGeneric or specific? Making sensible software design decisions
Generic or specific? Making sensible software design decisions
 
%in Durban+277-882-255-28 abortion pills for sale in Durban
%in Durban+277-882-255-28 abortion pills for sale in Durban%in Durban+277-882-255-28 abortion pills for sale in Durban
%in Durban+277-882-255-28 abortion pills for sale in Durban
 
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
Exploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfExploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdf
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 

Branch in Time (a story about revision histories)

  • 1. Branch in Time A story about revision histories @tekin
  • 4. class PatientsController < ApplicationController before_action :load_doctor def index @patients = sorted_patients end def show @patient = @doctor.patients.find(params[:id]) end private def sorted_patients @doctor.patients.sort { |patient| patient.name } end def load_doctor @doctor = doctor_from_current_session
  • 5. class PatientsController < ApplicationController before_action :load_doctor def index @patients = sorted_patients end def show @patient = @doctor.patients.find(params[:id]) end private def sorted_patients @doctor.patients.sort { |patient| patient.name } end def load_doctor @doctor = doctor_from_current_session
  • 6. class PatientsController < ApplicationController before_action :load_doctor def index @patients = sorted_patients end def show @patient = @doctor.patients.find(params[:id]) end private def sorted_patients @doctor.patients.order(:name) end def load_doctor @doctor = doctor_from_current_session
  • 7. class PatientsController < ApplicationController before_action :load_doctor def index @patients = sorted_patients end def show @patient = @doctor.patients.find(params[:id]) end private def sorted_patients @doctor.patients.order(:name) end def load_doctor @doctor = doctor_from_current_session $ rake Run options: --seed 45260 # Running: .................................................................... .................................................................... .................................................................... .................................... Finished in 123.299088s, 23.8629 runs/s, 34.6397 assertions/s. 3311 runs, 45124 assertions, 0 failures, 0 errors, 0 skips
  • 8. class Patient < ApplicationRecord has_many :appointments validates_presence_of :name, :address, :date_of_birth end class Doctor < ApplicationRecord has_many :appointments has_many :patients, through: :appointments belongs_to :practice validates_presence_of :name, :practice end
  • 10. $ git blame app/controllers/patients_controller.rb Git Fu: git blame
  • 11. 3fc122c2 (Richard E 2010-06-28 17:02:54 +0100 1) # Controller for listing a doctor's pa 3fc122c2 (Richard E 2010-06-28 17:02:54 +0100 2) class PatientsController < Application 3fc122c2 (Richard E 2010-06-28 17:02:54 +0100 3) before_filter :load_doctor 3fc122c2 (Richard E 2010-06-28 17:02:54 +0100 4) 3fc122c2 (Richard E 2010-06-28 17:02:54 +0100 5) def index 6047246d (Josie P 2010-10-29 09:32:25 +0100 6) @patients = sorted_patients 3fc122c2 (Richard E 2010-06-28 17:02:54 +0100 7) end 3fc122c2 (Richard E 2010-06-28 17:02:54 +0100 8) 9598514f (Josie P 2010-06-28 17:03:21 +0100 9) def show 9598514f (Josie P 2010-06-28 17:03:21 +0100 10) @patient = @doctor.patients.find(p 9598514f (Josie P 2010-06-28 17:03:21 +0100 11) end 9598514f (Richard E 2010-06-28 17:03:21 +0100 12) 3fc122c2 (Richard E 2010-06-28 17:02:54 +0100 13) private dbdd0fb9 (Josie P 2010-10-29 09:31:52 +0100 18) 6047246d (Josie P 2010-10-29 09:32:25 +0100 19) def sorted_patients dbdd0fb9 (Josie P 2010-10-29 09:31:52 +0100 20) @doctor.patients.sort {|patient| p dbdd0f69 (Josie P 2010-10-29 09:31:52 +0100 21) end 3fc122c2 (Richard E 2010-06-28 17:02:54 +0100 14) $ git blame app/controllers/patients_controller.rb Git Fu: git blame
  • 12. --patch Git Fu: git blame $ git log dbdd0fb9
  • 13. $ git log dbdd0fb9 --patch commit dbdd0fb9e870b91e6925903553f07df3becc9414 Author: Josie Pickford<josie@docs-r-us.com> Date: Fri Oct 29 09:31:52 2010 +0100 PR Feedback: Fixed a typo diff --git a/app/controllers/patients_controller.rb b/app/controllers/patients_controller index d7c6df5..1e3debb 100644 --- a/app/controllers/patients_controller.rb +++ b/app/controllers/patients_controller.rb @@ -13,7 +13,7 @@ class PatientsController < ApplicationController private def sorted_patients - @doctor.patients.sort {|pateint| pateint.name } + @doctor.patients.sort {|patient| patient.name } end Git Fu: git blame
  • 14. Git Fu 1. git blame 2. git log -S (AKA The Pickaxe)
  • 15. Git Fu: git log -S (AKA The Pickaxe) $ git log -S "sorted_patients" --patch --reverse
  • 16. Git Fu: git log -S (AKA The Pickaxe) $ git log -S "sorted_patients" --patch --reverse commit 23b6e0c6a9a7a392c312d4f0c51153e0769ebffc Author: Josie Pickford<josie@docs-r-us.com> Date: Thurs Oct 28 17:55:32 2010 +0100 Rename method diff --git a/app/controllers/patients_controller.rb b/app/controllers/ patients_controller.rb index 51fbd8a..d7c6df5 100644 --- a/app/controllers/patients_controller.rb +++ b/app/controllers/patients_controller.rb @@ -3,7 +3,7 @@ class PatientsController < ApplicationController before_filter :load_doctor def index - @patients = load_patients + @patients = sorted_patients end
  • 17. Git Fu 1. git blame 2. git log -S (AKA The Pickaxe) 3. Pickaxe Round 2
  • 18. Git Fu: Pickaxe Round 2 $ git log -S "load_patients" --patch --reverse commit 66f95816017b1c6582034d074333fa18884ad3c3 Author: Josie Pickford<josie@docs-r-us.com> Date: Thurs Oct 28 17:00:43 2010 +0100 Fix patient ordering bug diff --git a/app/controllers/patients_controller.rb b/app/controllers/patients_controller index cb0e69c..51fbd8a 100644 --- a/app/controllers/patients_controller.rb +++ b/app/controllers/patients_controller.rb @@ -3,7 +3,7 @@ class PatientsController < ApplicationController before_filter :load_doctor def index - @patients = @doctor.patients.order(:name) + @patients = load_patients end
  • 19. Git Fu 1. git blame 2. git log -S (AKA The Pickaxe) 3. Pickaxe Round 2 4. Find the Pull Request
  • 20. Git Fu: Find the Pull Request
  • 21. Git Fu: Find the Pull Request
  • 22. Git Fu: Find the Pull Request
  • 23. Git Fu: Find the Pull Request
  • 24.
  • 28. Y U NO ALPHABETICAL!?
  • 29. class PatientsController < ApplicationController before_filter :load_doctor def index @patients = @doctor.patients.order(:name) end def show @patient = @doctor.patients.find(params[:id]) end private def load_doctor @doctor = doctor_from_current_session end end
  • 30. class PatientsController < ApplicationController before_filter :load_doctor def index @patients = @doctor.patients.order(:name) end def show @patient = @doctor.patients.find(params[:id]) end private def load_doctor @doctor = doctor_from_current_session end end
  • 31. class Doctor < ApplicationRecord has_many :appointments, order: :appointment_date has_many :patients, through: :appointments belongs_to :practice validates_presence_of :name, :practice end
  • 32. class Doctor < ApplicationRecord has_many :appointments, order: :appointment_date has_many :patients, through: :appointments belongs_to :practice validates_presence_of :name, :practice end
  • 33. class Doctor < ApplicationRecord has_many :appointments, order: :appointment_date has_many :patients, through: :appointments belongs_to :practice validates_presence_of :name, :practice end doctor.patients.order(:name) Patients Load (1.0ms) SELECT "patients".* FROM "patients" INNER JOIN "appointments" ON "patients"."id" = "appointments"."patient_id" WHERE “appointments"."doctor_id" = $1 ORDER BY “appointments"."appointment_date" ASC, "patients"."name" ASC irb(main):003:0>
  • 34. class Doctor < ApplicationRecord has_many :appointments has_many :patients, through: :appointments belongs_to :practice validates_presence_of :name, :practice end , order: :appointment_date
  • 35. class Doctor < ApplicationRecord has_many :appointments has_many :patients, through: :appointments belongs_to :practice validates_presence_of :name, :practice end $ rake Run options: --seed 45260 # Running: .....F..........FFFF.........F..........FF..............FFFFFFFFF... ..............FFFFFFFFFFFFFFFFFF............................FFFF Finished in 1.273019s, 24.3516 runs/s, 35.3490 assertions/s.
  • 36. class PatientsController < ApplicationController before_filter :load_doctor def index @patients = @doctor.patients.order(:name) end def show @patient = @doctor.patients.find(params[:id]) end private def load_doctor @doctor = doctor_from_current_session end end
  • 37. class PatientsController < ApplicationController before_filter :load_doctor def index @patients = end def show @patient = @doctor.patients.find(params[:id]) end private def load_patients @doctor.patients.sort { |pateint| pateint.name } end def load_doctor @doctor = doctor_from_current_session load_patients
  • 42. Just one more commit...
  • 47. No reorder( ) in Rails 2.3.8 Intermission
  • 50. Damn fine coffee! 8 years ago... ☕Josie
  • 51. Y U NO ALPHABETICAL!?
  • 55. Git Fu 1. git rebase --interactive
  • 56. git rebase --interactive head~3 Git Fu: git rebase --interactive $
  • 57. git rebase --interactive head~3 Git Fu: git rebase --interactive $
  • 58. git rebase --interactive head~3 Git Fu: git rebase --interactive $
  • 59. Git Fu: git rebase --interactive git rebase --interactive head~3$
  • 62. Fix the build git add test/integration $ $ [fix-patient-order-bug ee74d2f] Fix patient ordering bug Date: Fri Oct 29 09:36:08 2010 +0100 3 files changed, 44 insertions(+), 3 deletion(-) $ git commit --amend --no-edit
  • 63. Fix the build git push --force-with-lease git add test/integration $ $ [fix-patient-order-bug ee74d2f] Fix patient ordering bug Date: Fri Oct 29 09:36:08 2010 +0100 3 files changed, 44 insertions(+), 3 deletion(-) $ git commit --amend --no-edit
  • 67. class PatientsController < ApplicationController before_action :load_doctor def index @patients = sorted_patients end def show @patient = @doctor.patients.find(params[:id]) end private def sorted_patients @doctor.patients.sort { |patient| patient.name } end def load_doctor @doctor = doctor_from_current_session
  • 68. 3fc122c2 (Richard E 2010-06-28 17:02:54 +0100 1) # Controller for listing a doctor's pa 3fc122c2 (Richard E 2010-06-28 17:02:54 +0100 2) class PatientsController < Application 3fc122c2 (Richard E 2010-06-28 17:02:54 +0100 3) before_filter :load_doctor 3fc122c2 (Richard E 2010-06-28 17:02:54 +0100 4) 3fc122c2 (Richard E 2010-06-28 17:02:54 +0100 5) def index 6047246d (Josie P 2010-10-29 09:32:25 +0100 6) @patients = sorted_patients 3fc122c2 (Richard E 2010-06-28 17:02:54 +0100 7) end 3fc122c2 (Richard E 2010-06-28 17:02:54 +0100 8) 9598514f (Josie P 2010-06-28 17:03:21 +0100 9) def show 9598514f (Josie P 2010-06-28 17:03:21 +0100 10) @patient = @doctor.patients.find(p 9598514f (Josie P 2010-06-28 17:03:21 +0100 11) end 9598514f (Richard E 2010-06-28 17:03:21 +0100 12) 3fc122c2 (Richard E 2010-06-28 17:02:54 +0100 13) private dbdd0fb9 (Josie P 2010-10-29 09:31:52 +0100 18) 6047246d (Josie P 2010-10-29 09:32:25 +0100 19) def sorted_patients 33ec144e (Josie P 2010-10-29 09:31:52 +0100 20) @doctor.patients.sort {|patient| p dbdd0f69 (Josie P 2010-10-29 09:31:52 +0100 21) end 3fc122c2 (Richard E 2010-06-28 17:02:54 +0100 14) $ git blame app/controllers/patients_controller.rb Git Fu: git blame
  • 69. $ git log 33ec144e --patch commit 33ec144e70b91e6925903553f07df3becc9414 Author: Josie Pickford<josie@docs-r-us.com> Date: Friday Oct 29 09:44:49 2010 +0100 Fix patient ordering bug The patients association is returning patients in appointment date order, even when called with an explicit `order(:name)` scope. This is because the patients association is a has_many :through the appointments association, which has a default order by appointment_date. This causes any queries on the association to always sort first by appointment date: ORDER BY “appointments"."appointment_date" ASC, "patients"."name" ASC) Removing the default ordering from the appointments association is going to take a bit of unpicking. To get the bug resolved in the meantime we can re-sort the patient records after they've been loaded. Separate work has been planned to remove the default ordering altogether. Git Fu: git blame
  • 70. class Doctor < ApplicationRecord has_many :appointments has_many :patients, through: :appointments belongs_to :practice validates_presence_of :name, :practice end
  • 71.
  • 72. • Naming things • Automated tests • Abstractions • Refactoring
  • 73. Your software is more than the code
  • 74.
  • 77.
  • 78.
  • 79.
  • 80. Git Fu 1. Configure an environment for good commit messages
  • 81. Configure an environment for good commit messages $ git commit -m "Did a thing"
  • 82. Configure an environment for good commit messages $ git config --global core.editor “subl -w”
  • 83. Configure an environment for good commit messages $ git config --global commit.verbose true
  • 84. Git Fu 1. Configure an environment for good commit messages 2. Capture the why, not the what
  • 85. Capture the why, not the what
  • 86. Git Fu 1. Configure an environment for good commit messages 2. Capture the why, not the what 3. Shape each commit
  • 87. Shape each commit • Create small atomic commits • Shape as you go, not at the end • $ git add --patch / -p
  • 88. Shape each commit dd3b43c Refactor Foo 44b4bd8 Add Bar to Foo
  • 89. Git Fu 1. Configure an environment for good commit messages 2. Capture the why, not the what 4. Treat (local) commits as mutable 3. Shape each commit
  • 90. Treat (local) commits as mutable • $ git commit --amend • $ git rebase --interactive • $ git rebase --abort • --fixup / --autosquash
  • 91. Git Fu 1. Configure an environment for good commit messages 2. Capture the why, not the what 5. Build your instincts; search your histories 4. Treat (local) commits as mutable 3. Shape each commit
  • 92. Build your instincts; search your histories • $ git blame file.rb • $ git log -S "some_code" • $ git annotate file.rb
  • 93. Git Fu 1. Configure an environment for good commit messages 2. Capture the why, not the what 5. Treat (local) commits as mutable 4. Build your instincts; search your histories 3. Shape each commit
  • 95.
  • 96.
  • 97. Thanks for the Git Fu @dgheath21@angelajtodd@grahamashton
  • 99. Seema Memoji Josie Memoji Created by Inspiration for the story-based approach Talk Feedback and Advice Slide Advisor Git Fu Indent Hospital Icon Winding Road Photo Sound Effects TEKIN SULEYMAN TEKIN SULEYMAN TEKIN SULEYMAN NADIA ODUNAYO ANDY CROLL ANGELA TODD GRAHAM ASHTON MURRAY STEELE NADIA ODUNAYO KATRINA OWEN BRUCE LEE, ENTER THE DRAGON (1972) FLATICON.COM JESSE BOWSER ON UNSPLASH LEGEND OF ZELDA, A LINK TO THE PAST Cast
  • 100. Branch in Time A story about revision histories @tekin