SlideShare a Scribd company logo
Real-World Git
Stuff We Didn’t Cover Last Time
Stuff to Cover
1. Migrating from Subversion
2. Branching strategies
3. Branch-management commands
a. Merge
b. Rebase
c. Interactive rebase
d. Cherry pick
Migrating from Subversion
Three aspects:
1. Import commits
2. Clean up metadata
a. Authors
b. Tags
3. eHarmony infrastructure
Best practice:
Repository per
artifact
Easier Way
git svn clone <subversion_url>
• Built into git, brings in all commits and branches
• Can import Subversion subdirectories
http://git-scm.com/book/en/Git-and-Other-Systems-Migrating-to-Git
• Authors looks like this in history:
rwarren <rwarren@4c93b258-373f-11de-
be05-5f7a86268029>
• Subversion tags become Git branches
More Complete Way
1. Get svn2git from
https://github.com/nirvdrum/svn2git
2. Build list of authors in your history
• Manually, or:
svn log ^/ --xml | grep -P
"^<author" | sort -u | perl -pe
's/<author>(.*?)</author>/$1 = /'
More Complete Way
3. Import: svn2git <subversion_url>
<local_dir> --authors
<authors_file>
https://wiki.corp.eharmony.com/display/MAT/Matching+SVN+to+Git+migration
• Subversion tags are recognized as Git tags
• Authors look like this in the history:
Rick Warren <rwarren@eharmony.com>
Either Way
1. Push to Git repository:
$ git remote add origin <git_url>
$ git push origin --all
$ git push origin --tags
2. Set up eHarmony stuff
a. Add build/release jobs in Jenkins
b. Add repositories to Crucible
Branching Strategies
Remember:
• Everything is a branch. It ain’t no thing, y’all.
• You can rename or rebase your branch if you
screw up (but you’ll cause pain to your team)
• Stuff happens: keep one branch releasable.
What We Do in Matching
• Release from master, and keep it releasable
• Do stories on branches: “MAT-1234_feature”
• When master released, merge to branch
• Preliminary QA acceptance on branch
• Merge to master, release, accept again
Fancier: Git Flow
• master == latest release
• develop == latest integration, accumulating
merges until next release
• Specialized branches, off develop:
features, hot fixes, release stabilization
• Built directly into some Git clients
http://nvie.com/posts/a-successful-git-branching-model/
Rebasing
• Replay the commits of one branch on top of another branch
• Use as an alternative to merge, if you value “clean” history
http://git-scm.com/book/ch3-6.html
before after
Interactive Rebasing
Do any of these apply to you?
• Big, coarse commits: you fear sharing changes too
early.
• Lots going on in your working copy: you lose track
of what you’ve changed, and occasionally revert a
file by accident.
• Five minutes after committing, you realize you
missed something.
Solution: Interactive Rebase
• Commit early and often, to checkpoint each fine-
grained change.
• Wait to push until ready to share.
• Squash and reorder unshared commits in the
mean time.
older
newer
git rebase -i
$ git rebase -i HEAD~5
In editor:
pick 2174c26 MAT-1234: Pruned dependencies
pick 4d1d456 MAT-5678: Improved validation
pick aedba8f MAT-9876: Updated API
pick 6727eca MAT-5432: Removed cruft
pick 0afb08b MAT-1098: Fixed bean name
git rebase -i
pick: Keep commit
reword: Change message
squash: Combine with previous
pick 2174c26 MAT-1234: Pruned dependencies
pick 4d1d456 MAT-5678: Improved validation
pick aedba8f MAT-9876: Updated API
pick 6727eca MAT-5432: Removed cruft
pick 0afb08b MAT-1098: Fixed bean name
Word of Warning
• Commits are immutable
• Rebasing doesn’t delete old commits; it just
makes new ones
• Rebasing can’t remove those old commits from
others’ local repositories
• Don’t rebase any commits that you’ve pushed
Cherry Pick
• Copy commit(s) from history onto current branch
• Leaves source branch alone
• Use when merging is impossible or premature
http://git-scm.com/docs/git-cherry-pick
Please Enjoy Git
Responsibly

More Related Content

PPTX
git Technologies
PPTX
Git Branch
PPTX
Demystifying Git
PPTX
Git learning
PDF
Git and GitHub workflows
PDF
Git and GitHub crash course
PPTX
Git tutorial git branches 20131206-Bryan
PPTX
Introduction to git
git Technologies
Git Branch
Demystifying Git
Git learning
Git and GitHub workflows
Git and GitHub crash course
Git tutorial git branches 20131206-Bryan
Introduction to git

What's hot (19)

PPTX
Introduction to Git and GitHub Part 2
PPTX
Git 101
PPTX
Introduction to github slideshare
ODP
Git presentation
PPTX
Version control git day02
PPTX
Introduction to Git and GitHub Part 1
PPTX
Git workshop - University of Moratuwa, Department of Computer Science and Eng...
PPTX
Version control git day01
PPT
Migrating to git
PDF
Git & GitHub N00bs
PDF
Subversion to Git Migration
PPTX
HacktoberFest-Git&GitHub
PPTX
Using Git and BitBucket
KEY
Git with bitbucket
PPTX
Git and Github Session
PPTX
Workshop on Git and GitHub
PPTX
Getting Started with Git: A Primer for SVN and TFS Users
PDF
Cheltenham Geeks - git talk/interactive session
PPTX
Webinar : SVN to GIT Migration
Introduction to Git and GitHub Part 2
Git 101
Introduction to github slideshare
Git presentation
Version control git day02
Introduction to Git and GitHub Part 1
Git workshop - University of Moratuwa, Department of Computer Science and Eng...
Version control git day01
Migrating to git
Git & GitHub N00bs
Subversion to Git Migration
HacktoberFest-Git&GitHub
Using Git and BitBucket
Git with bitbucket
Git and Github Session
Workshop on Git and GitHub
Getting Started with Git: A Primer for SVN and TFS Users
Cheltenham Geeks - git talk/interactive session
Webinar : SVN to GIT Migration
Ad

Viewers also liked (20)

PPTX
El respeto a todos nos toca
PPTX
Construyendo nuestra vida ibe callao #12
PPTX
Ester, llamada para el momento oportuno # 3 ibe callao
PDF
Libro rick warren - el poder de transformar su vida
PPTX
Cuidando lo que amamos y lo que tenemos 8
PPTX
Restaurando nuestro arbol genealogico i ibe pachacutec
PPTX
Usando nuestros hombros aniversario 2014 ibe callao
PPTX
Convicciones que transforman #11 ibe callao
PPTX
La seguridad de la salvación iii aniversario ibe callao
PPTX
Como entender a mi pareja ibe callao 2015
PDF
El perdon 02 (matrimonios)
PPT
Lo que debo de saber antes de ofrendar
PPTX
Orando por los planes futuros Parte 2 - 19.12.2012
PPTX
La seguridad de la salvación iv aniversario ibe callao
PPTX
Si la cama hablara ibe callao minis matrimonios
PPTX
Ser como jesus servidores ibe callao marzo 2016 ok
PDF
El perdon 03 (matrimonios)
PPT
Una vida-con-proposito3819
PPTX
Cómo vivir sin que peleas nos distancien ibe callao ministerio matrimonios
PDF
Rick Warren - Liderazgo con Propósito Especialmente pata Ti.
El respeto a todos nos toca
Construyendo nuestra vida ibe callao #12
Ester, llamada para el momento oportuno # 3 ibe callao
Libro rick warren - el poder de transformar su vida
Cuidando lo que amamos y lo que tenemos 8
Restaurando nuestro arbol genealogico i ibe pachacutec
Usando nuestros hombros aniversario 2014 ibe callao
Convicciones que transforman #11 ibe callao
La seguridad de la salvación iii aniversario ibe callao
Como entender a mi pareja ibe callao 2015
El perdon 02 (matrimonios)
Lo que debo de saber antes de ofrendar
Orando por los planes futuros Parte 2 - 19.12.2012
La seguridad de la salvación iv aniversario ibe callao
Si la cama hablara ibe callao minis matrimonios
Ser como jesus servidores ibe callao marzo 2016 ok
El perdon 03 (matrimonios)
Una vida-con-proposito3819
Cómo vivir sin que peleas nos distancien ibe callao ministerio matrimonios
Rick Warren - Liderazgo con Propósito Especialmente pata Ti.
Ad

Similar to Real-World Git (20)

PPTX
Conflicting Advice on Git Usage Patterns & Their Implications
PPTX
Git more done
PPTX
MakingGitWorkForYou
PPTX
PPTX
Git tips
PPTX
Git presentation bixlabs
PDF
Svn to-git
PPTX
Git workshop 33degree 2011 krakow
PDF
GIT_training_SoftServeBulgaria2016
PDF
Transformative Git Practices
PPTX
Git and git workflow best practice
PPT
Git presentation
PDF
Git vs Subversion: ¿Cuando elegir uno u otro?
PDF
Effective Git
PPTX
PDF
Smalltalk on Git
PDF
BRANCHING MODELS (workshop)
KEY
Git Basics Philips
PPT
Git-GitHub.ppt for teaching all college stidents
PPTX
01 - Git vs SVN
Conflicting Advice on Git Usage Patterns & Their Implications
Git more done
MakingGitWorkForYou
Git tips
Git presentation bixlabs
Svn to-git
Git workshop 33degree 2011 krakow
GIT_training_SoftServeBulgaria2016
Transformative Git Practices
Git and git workflow best practice
Git presentation
Git vs Subversion: ¿Cuando elegir uno u otro?
Effective Git
Smalltalk on Git
BRANCHING MODELS (workshop)
Git Basics Philips
Git-GitHub.ppt for teaching all college stidents
01 - Git vs SVN

More from Rick Warren (20)

PDF
Building Scalable Stateless Applications with RxJava
PPTX
Letters from the Trenches: Lessons Learned Taking MongoDB to Production
PPTX
Patterns of Data Distribution
PPTX
Data-centric Invocable Services
PDF
Engineering Interoperable and Reliable Systems
PPTX
Scaling DDS to Millions of Computers and Devices
PDF
DDS in a Nutshell
PDF
Java 5 Language PSM for DDS: Final Submission
PPTX
Java 5 PSM for DDS: Revised Submission (out of date)
PPTX
C++ PSM for DDS: Revised Submission
PPTX
Web-Enabled DDS: Revised Submission
PPTX
Java 5 PSM for DDS: Initial Submission (out of date)
PDF
Extensible and Dynamic Topic Types for DDS, Beta 1
PPTX
Mapping the RESTful Programming Model to the DDS Data-Centric Model
PPTX
Large-Scale System Integration with DDS for SCADA, C2, and Finance
PPT
Data-Centric and Message-Centric System Architecture
PPTX
Extensible and Dynamic Topic Types for DDS
PPTX
Easing Integration of Large-Scale Real-Time Systems with DDS
PPTX
Java 5 API for DDS RFP (out of date)
PPTX
Introduction to DDS
Building Scalable Stateless Applications with RxJava
Letters from the Trenches: Lessons Learned Taking MongoDB to Production
Patterns of Data Distribution
Data-centric Invocable Services
Engineering Interoperable and Reliable Systems
Scaling DDS to Millions of Computers and Devices
DDS in a Nutshell
Java 5 Language PSM for DDS: Final Submission
Java 5 PSM for DDS: Revised Submission (out of date)
C++ PSM for DDS: Revised Submission
Web-Enabled DDS: Revised Submission
Java 5 PSM for DDS: Initial Submission (out of date)
Extensible and Dynamic Topic Types for DDS, Beta 1
Mapping the RESTful Programming Model to the DDS Data-Centric Model
Large-Scale System Integration with DDS for SCADA, C2, and Finance
Data-Centric and Message-Centric System Architecture
Extensible and Dynamic Topic Types for DDS
Easing Integration of Large-Scale Real-Time Systems with DDS
Java 5 API for DDS RFP (out of date)
Introduction to DDS

Recently uploaded (20)

PDF
Web App vs Mobile App What Should You Build First.pdf
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
Assigned Numbers - 2025 - Bluetooth® Document
PPTX
Programs and apps: productivity, graphics, security and other tools
PPTX
Group 1 Presentation -Planning and Decision Making .pptx
PDF
Hindi spoken digit analysis for native and non-native speakers
PDF
gpt5_lecture_notes_comprehensive_20250812015547.pdf
PPTX
Tartificialntelligence_presentation.pptx
PDF
1 - Historical Antecedents, Social Consideration.pdf
PDF
Mushroom cultivation and it's methods.pdf
PPTX
SOPHOS-XG Firewall Administrator PPT.pptx
PPTX
TLE Review Electricity (Electricity).pptx
PDF
Video forgery: An extensive analysis of inter-and intra-frame manipulation al...
PPTX
TechTalks-8-2019-Service-Management-ITIL-Refresh-ITIL-4-Framework-Supports-Ou...
PPTX
OMC Textile Division Presentation 2021.pptx
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PPTX
cloud_computing_Infrastucture_as_cloud_p
PDF
Accuracy of neural networks in brain wave diagnosis of schizophrenia
PDF
Getting Started with Data Integration: FME Form 101
Web App vs Mobile App What Should You Build First.pdf
Digital-Transformation-Roadmap-for-Companies.pptx
Assigned Numbers - 2025 - Bluetooth® Document
Programs and apps: productivity, graphics, security and other tools
Group 1 Presentation -Planning and Decision Making .pptx
Hindi spoken digit analysis for native and non-native speakers
gpt5_lecture_notes_comprehensive_20250812015547.pdf
Tartificialntelligence_presentation.pptx
1 - Historical Antecedents, Social Consideration.pdf
Mushroom cultivation and it's methods.pdf
SOPHOS-XG Firewall Administrator PPT.pptx
TLE Review Electricity (Electricity).pptx
Video forgery: An extensive analysis of inter-and intra-frame manipulation al...
TechTalks-8-2019-Service-Management-ITIL-Refresh-ITIL-4-Framework-Supports-Ou...
OMC Textile Division Presentation 2021.pptx
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Building Integrated photovoltaic BIPV_UPV.pdf
cloud_computing_Infrastucture_as_cloud_p
Accuracy of neural networks in brain wave diagnosis of schizophrenia
Getting Started with Data Integration: FME Form 101

Real-World Git

  • 1. Real-World Git Stuff We Didn’t Cover Last Time
  • 2. Stuff to Cover 1. Migrating from Subversion 2. Branching strategies 3. Branch-management commands a. Merge b. Rebase c. Interactive rebase d. Cherry pick
  • 3. Migrating from Subversion Three aspects: 1. Import commits 2. Clean up metadata a. Authors b. Tags 3. eHarmony infrastructure Best practice: Repository per artifact
  • 4. Easier Way git svn clone <subversion_url> • Built into git, brings in all commits and branches • Can import Subversion subdirectories http://git-scm.com/book/en/Git-and-Other-Systems-Migrating-to-Git • Authors looks like this in history: rwarren <rwarren@4c93b258-373f-11de- be05-5f7a86268029> • Subversion tags become Git branches
  • 5. More Complete Way 1. Get svn2git from https://github.com/nirvdrum/svn2git 2. Build list of authors in your history • Manually, or: svn log ^/ --xml | grep -P "^<author" | sort -u | perl -pe 's/<author>(.*?)</author>/$1 = /'
  • 6. More Complete Way 3. Import: svn2git <subversion_url> <local_dir> --authors <authors_file> https://wiki.corp.eharmony.com/display/MAT/Matching+SVN+to+Git+migration • Subversion tags are recognized as Git tags • Authors look like this in the history: Rick Warren <rwarren@eharmony.com>
  • 7. Either Way 1. Push to Git repository: $ git remote add origin <git_url> $ git push origin --all $ git push origin --tags 2. Set up eHarmony stuff a. Add build/release jobs in Jenkins b. Add repositories to Crucible
  • 8. Branching Strategies Remember: • Everything is a branch. It ain’t no thing, y’all. • You can rename or rebase your branch if you screw up (but you’ll cause pain to your team) • Stuff happens: keep one branch releasable.
  • 9. What We Do in Matching • Release from master, and keep it releasable • Do stories on branches: “MAT-1234_feature” • When master released, merge to branch • Preliminary QA acceptance on branch • Merge to master, release, accept again
  • 10. Fancier: Git Flow • master == latest release • develop == latest integration, accumulating merges until next release • Specialized branches, off develop: features, hot fixes, release stabilization • Built directly into some Git clients http://nvie.com/posts/a-successful-git-branching-model/
  • 11. Rebasing • Replay the commits of one branch on top of another branch • Use as an alternative to merge, if you value “clean” history http://git-scm.com/book/ch3-6.html before after
  • 12. Interactive Rebasing Do any of these apply to you? • Big, coarse commits: you fear sharing changes too early. • Lots going on in your working copy: you lose track of what you’ve changed, and occasionally revert a file by accident. • Five minutes after committing, you realize you missed something.
  • 13. Solution: Interactive Rebase • Commit early and often, to checkpoint each fine- grained change. • Wait to push until ready to share. • Squash and reorder unshared commits in the mean time.
  • 14. older newer git rebase -i $ git rebase -i HEAD~5 In editor: pick 2174c26 MAT-1234: Pruned dependencies pick 4d1d456 MAT-5678: Improved validation pick aedba8f MAT-9876: Updated API pick 6727eca MAT-5432: Removed cruft pick 0afb08b MAT-1098: Fixed bean name
  • 15. git rebase -i pick: Keep commit reword: Change message squash: Combine with previous pick 2174c26 MAT-1234: Pruned dependencies pick 4d1d456 MAT-5678: Improved validation pick aedba8f MAT-9876: Updated API pick 6727eca MAT-5432: Removed cruft pick 0afb08b MAT-1098: Fixed bean name
  • 16. Word of Warning • Commits are immutable • Rebasing doesn’t delete old commits; it just makes new ones • Rebasing can’t remove those old commits from others’ local repositories • Don’t rebase any commits that you’ve pushed
  • 17. Cherry Pick • Copy commit(s) from history onto current branch • Leaves source branch alone • Use when merging is impossible or premature http://git-scm.com/docs/git-cherry-pick