SlideShare a Scribd company logo
Advanced GIT
or How to Change the History
Speaker: Sergey Nezbritskiy
Why ?
2
Prerequisites
list of used commands:
- git show <reference>
- git log --oneline --graph
- git log --oneline --graph --all
What you should know about GIT:
- References in git: commit hash, branch, tag, HEAD
- Fast-forwarding - When merging one commit with a commit that can be reached
by following the first commit’s history, Git simplifies things by moving the
pointer forward because there is no divergent work to merge together
3
4
How
boys git log girls
tell stories
5
* 6e534ad490f (HEAD -> 2.3-develop, origin/HEAD, origin/2.3-develop) Merge pull request #4350 from magento-arcticfoxes/2.3-develop-pr
|
| * bae699dba0c Merge remote-tracking branch 'upstream/2.3-develop' into 2.3-develop-pr
| |
| |/
|/|
* | 977753bce8d Merge pull request #4345 from magento-mpi/pr_2019_06_11_ce
| 
| *  2dce436dabd Merge remote-tracking branch 'magento2/2.3-develop' into pr_2019_06_11_ce
| | 
| |/ /
|/| |
* | | 8e16abce80b Merge pull request #4320 from magento-tsg-csl3/2.3-develop-pr24
|  
| *   9283ef0298a Merge remote-tracking branch 'mainline/2.3-develop' into 2.3-develop-pr24
| |  
| |/ / /
|/| | |
* | | | 163302f4794 Merge pull request #4330 from magento-obsessive-owls/MC-16599
|   
| *    e5ab4b670b0 merge magento/2.3-develop into magento-obsessive-owls/MC-16599
| |   
| |/ / / /
|/| | | |
* | | | | 6801e95b74f Merge pull request #4334 from magento-qwerty/MAGETWO-55809
|    
| *     e5a1e8132f2 merge magento/2.3-develop into magento-qwerty/MAGETWO-55809
| |    
| |/ / / / /
|/| | | | |
| * | | | | b2a75ff3a31 merge magento/2.3-develop into magento-qwerty/MAGETWO-55809
| |    
| *      65a3242dda1 Merge branch 'MAGETWO-55809' of https://github.com/magento-qwerty/magento2ce into MAGETWO-55809
| |     
| | *      d95ece7ef98 merge magento/2.3-develop into magento-qwerty/MAGETWO-55809
| | |     
| | *       4d2757d178f merge magento/2.3-develop into magento-qwerty/MAGETWO-55809
| | |      
| * |        50237fde35c Merge branch '2.3-develop' of https://github.com/magento/magento2ce into MAGETWO-55809
| |        
| * | | | | | | | | | d86efb669ba MAGETWO-55809: Eliminate @escapeNotVerified in Module Backend
| | |/ / / / / / / /
| |/| | | | | | | |
| * | | | | | | | | 0f4f949db01 MAGETWO-55809: Eliminate @escapeNotVerified in Module Backend
git checkout 2.3-develop
git log --oneline --graph
6
TODO: example of perfect repository
¯_(ツ)_/¯
* ceb65ff (HEAD -> prod, tag: 2.5.18) [CHE-300] Contingency Block
* 6baf4b7 RIATCE-735: sticky PDP for a/b testing
* 96fbf9f RIATCE-1511: fix order of loading elements on homepage
* 84dcfce RIATCE-725: add search by image functionality
* 799799c RIATCE-731: implement new PDP
* decd884 RIATCS-1494: fix products count in title
* beec966 RIATCS-1476: changes for SEO, add missing titles
* 4268d31 RIATCS-1524: fix url key, do not replace with click url
* ff4c1e6 (tag: 2.5.17.1) [CHE-639] STS Price Update
* ba56e95 (tag: 2.5.17) [CHE-719] Performance
* 0a76b68 [CHE-707] Saved Brasgpag Card alias fix
* 30b9552 bug/VIT-334 Change query
* 539046c [CHE-466] Customer access token
* 2778ef8 [CHE-689] Valor de frete não aplicado ao cancelar cupom
* 2f4c307 [CHE-712] Fix parcelamento por catálogo
* ebb93cf Fixed virtual card token pattern checking
* 303e93b bug/VIT-409
* 837d021 fixed look data reference used to add to cart
* ebc6ad7 [CHE-652] Remove billet date calc
* b2a849b RIATCS-1494: fix line below header
* 2cc3920 RIATCS-1486: remove disabling old loader in js
* ff48b07 RIATCS-1485: remove old loader
* 4aa81a1 RIATCS-1401: change text in loader
* 3c29d53 RIATCS-1423: merge branch sprint-40-final
* 66a1b55 RIATCS-1476: change text in info_for_user section
* fc980e7 RPV-82 - new front my orders
* 3776b56 RIATCS-1475: add hart icon to gallery.phtm in Xumulus_FastGalleryLoad module
* 467156b (tag: 2.5.17.3) RIATCS-1475 looks pdp issues
* db6e6c7 RIATCS-1483: add functionality for new installment text working only on usual product
7
git checkout prod
git log --oneline --graph
REBASE
Integrates changes from one branch into another.
Rewrites the commit history in order to produce a straight, linear
sequence of commits.
8
REBASE WITH --onto
9
o---o---o---o---o master

o---o---o---x---o stage

o---o---o feature
git rebase --onto master stage feature
o---o---o---x---o master
| 
| o'--o'--o' feature

o---o---o---o---o stage
git rebase [--onto <newbase>] [<oldest commit (excl)> [<newest commit>]]
REBASE EVERYTHING ONTO ANYTHING
1
0
git rebase --onto master stage feature
git rebase --onto HEAD~7 HEAD~4 HEAD
git rebase --onto feature~8 feature~5 feature
git rebase --onto 0f4db90 a14dab7 43ae1cd
REBASE ONTO ITSELF
1
1
E---F---G---H---I---J topicA
E---F---I---J topicA
git rebase --onto F H J
git rebase --onto F F J
git rebase F
E---F---I---J topicA
INTERACTIVE REBASE
1
2
git rebase -i
REVERT
Revert some existing commits by representing new
commit
1
3
RESET
Reset current HEAD to the specified
state
1
4
--soft --mixed (default) --hard
index ✘ ✔ ✔
local tree ✘ ✘ ✔
HARD RESET
git reset --hard
1
5
WARNING !!!
Operations with commit history change commit hashes,
hence if you previously pushed your changes to remote
repository, after changing commits hashes you have to push
it with --force option
1
6
USEFUL RESOURCES
- git <command> --help
- https://git-scm.com/docs
- `git status` suggestions
1
7
REPOSITORY WITH CODE SAMPLES
1
8
https://github.com/magento-meetup-6/umbrella

More Related Content

PDF
Sprint 118
PPTX
PDF
GIT - GOOD PRACTICES
PDF
Version Control with Git
PDF
Undoing Things in Git
DOCX
Kickstat File_Draft_ESXI5.1_Template
PDF
AtlasCamp 2015 Docker continuous integration training
PDF
Github integration-kostyasha
Sprint 118
GIT - GOOD PRACTICES
Version Control with Git
Undoing Things in Git
Kickstat File_Draft_ESXI5.1_Template
AtlasCamp 2015 Docker continuous integration training
Github integration-kostyasha

Similar to Advanced GIT or How to Change the History (20)

PDF
DeveloperWeek 2015: A Practical Introduction to Docker
PDF
Sprint 130
PDF
Git For The Android Developer
PDF
Introducing Scylla Manager: Cluster Management and Task Automation
PDF
Sprint 131
PDF
Git workflows automat-it
TXT
PDF
K8s上の containerized cloud foundryとcontainerized open stackをprometheusで監視してみる
PPTX
Scaling Development Environments with Docker
PPTX
Using Git as your VCS with Bioconductor
PDF
Opencast Webinar — Opencast Encoding Profiles
PDF
4 Sessions
PDF
Packaging Strategy for Community Openstack and Implementation Reference | Hoj...
PPTX
PostgreSQL 13 New Features
PDF
Magie di git
PDF
Unleashing git power
PDF
Sprint 124
PDF
Git branching model_for_tap_team
PDF
Sprint 133
PDF
Sprint 138
DeveloperWeek 2015: A Practical Introduction to Docker
Sprint 130
Git For The Android Developer
Introducing Scylla Manager: Cluster Management and Task Automation
Sprint 131
Git workflows automat-it
K8s上の containerized cloud foundryとcontainerized open stackをprometheusで監視してみる
Scaling Development Environments with Docker
Using Git as your VCS with Bioconductor
Opencast Webinar — Opencast Encoding Profiles
4 Sessions
Packaging Strategy for Community Openstack and Implementation Reference | Hoj...
PostgreSQL 13 New Features
Magie di git
Unleashing git power
Sprint 124
Git branching model_for_tap_team
Sprint 133
Sprint 138
Ad

More from Magecom UK Limited (20)

PPTX
Magento Meetup #12. Alex Shkurko.pptx
PPTX
Magento Meetup #12 Anastasiia Bondar
PPTX
Magento Meetup #12 Vlad Opukhlyi
PPTX
Google Page Insights and Magento 2 — Sergey Nezbritskiy | Magento Meetup Onli...
PPTX
Magento NodeJS Microservices — Yegor Shytikov | Magento Meetup Online #11
PPTX
Magento enhanced media gallery - Alexander Shkurko
PPTX
7 ошибок одного Black Friday - Влад Опухлый
PPTX
Magento & Cloud - Korostelov Avexey
PDF
Making the Magento 2 Javascript Loading Great Again - Robin van Raan
PDF
Deep Dive in Magento DI
PDF
From Repositories to Commands - Alexander Shkurko
PPTX
MSI In-Store Pickup Функционал & сложности
PPTX
Adobe Stock Integration community project
PDF
Proof of Concept for Magento 2 Projects: Occamo’s Razor
PPTX
Что нужно знать девелоперу о SEO на этапе проектирования сайта
PPTX
Magento-сертификация: инструкция по применению и как это было
PPTX
Experience in Magento Community Projects
PPTX
UI components: synergy of backend and frontend
PPTX
MSI - Reservation Challenges with 3rd-party Systems
PPTX
Business wants what?!
Magento Meetup #12. Alex Shkurko.pptx
Magento Meetup #12 Anastasiia Bondar
Magento Meetup #12 Vlad Opukhlyi
Google Page Insights and Magento 2 — Sergey Nezbritskiy | Magento Meetup Onli...
Magento NodeJS Microservices — Yegor Shytikov | Magento Meetup Online #11
Magento enhanced media gallery - Alexander Shkurko
7 ошибок одного Black Friday - Влад Опухлый
Magento & Cloud - Korostelov Avexey
Making the Magento 2 Javascript Loading Great Again - Robin van Raan
Deep Dive in Magento DI
From Repositories to Commands - Alexander Shkurko
MSI In-Store Pickup Функционал & сложности
Adobe Stock Integration community project
Proof of Concept for Magento 2 Projects: Occamo’s Razor
Что нужно знать девелоперу о SEO на этапе проектирования сайта
Magento-сертификация: инструкция по применению и как это было
Experience in Magento Community Projects
UI components: synergy of backend and frontend
MSI - Reservation Challenges with 3rd-party Systems
Business wants what?!
Ad

Recently uploaded (20)

PDF
System and Network Administraation Chapter 3
PPTX
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
PDF
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
PDF
How Creative Agencies Leverage Project Management Software.pdf
PDF
How to Migrate SBCGlobal Email to Yahoo Easily
PDF
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
PDF
Softaken Excel to vCard Converter Software.pdf
PDF
Flood Susceptibility Mapping Using Image-Based 2D-CNN Deep Learnin. Overview ...
PDF
medical staffing services at VALiNTRY
PDF
Understanding Forklifts - TECH EHS Solution
PDF
AI in Product Development-omnex systems
PDF
Adobe Illustrator 28.6 Crack My Vision of Vector Design
PDF
Navsoft: AI-Powered Business Solutions & Custom Software Development
PDF
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
PDF
2025 Textile ERP Trends: SAP, Odoo & Oracle
PPTX
Reimagine Home Health with the Power of Agentic AI​
PDF
Adobe Premiere Pro 2025 (v24.5.0.057) Crack free
PPTX
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
PDF
Design an Analysis of Algorithms II-SECS-1021-03
PDF
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
System and Network Administraation Chapter 3
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
How Creative Agencies Leverage Project Management Software.pdf
How to Migrate SBCGlobal Email to Yahoo Easily
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
Softaken Excel to vCard Converter Software.pdf
Flood Susceptibility Mapping Using Image-Based 2D-CNN Deep Learnin. Overview ...
medical staffing services at VALiNTRY
Understanding Forklifts - TECH EHS Solution
AI in Product Development-omnex systems
Adobe Illustrator 28.6 Crack My Vision of Vector Design
Navsoft: AI-Powered Business Solutions & Custom Software Development
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
2025 Textile ERP Trends: SAP, Odoo & Oracle
Reimagine Home Health with the Power of Agentic AI​
Adobe Premiere Pro 2025 (v24.5.0.057) Crack free
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
Design an Analysis of Algorithms II-SECS-1021-03
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...

Advanced GIT or How to Change the History

  • 1. Advanced GIT or How to Change the History Speaker: Sergey Nezbritskiy
  • 3. Prerequisites list of used commands: - git show <reference> - git log --oneline --graph - git log --oneline --graph --all What you should know about GIT: - References in git: commit hash, branch, tag, HEAD - Fast-forwarding - When merging one commit with a commit that can be reached by following the first commit’s history, Git simplifies things by moving the pointer forward because there is no divergent work to merge together 3
  • 4. 4 How boys git log girls tell stories
  • 5. 5 * 6e534ad490f (HEAD -> 2.3-develop, origin/HEAD, origin/2.3-develop) Merge pull request #4350 from magento-arcticfoxes/2.3-develop-pr | | * bae699dba0c Merge remote-tracking branch 'upstream/2.3-develop' into 2.3-develop-pr | | | |/ |/| * | 977753bce8d Merge pull request #4345 from magento-mpi/pr_2019_06_11_ce | | * 2dce436dabd Merge remote-tracking branch 'magento2/2.3-develop' into pr_2019_06_11_ce | | | |/ / |/| | * | | 8e16abce80b Merge pull request #4320 from magento-tsg-csl3/2.3-develop-pr24 | | * 9283ef0298a Merge remote-tracking branch 'mainline/2.3-develop' into 2.3-develop-pr24 | | | |/ / / |/| | | * | | | 163302f4794 Merge pull request #4330 from magento-obsessive-owls/MC-16599 | | * e5ab4b670b0 merge magento/2.3-develop into magento-obsessive-owls/MC-16599 | | | |/ / / / |/| | | | * | | | | 6801e95b74f Merge pull request #4334 from magento-qwerty/MAGETWO-55809 | | * e5a1e8132f2 merge magento/2.3-develop into magento-qwerty/MAGETWO-55809 | | | |/ / / / / |/| | | | | | * | | | | b2a75ff3a31 merge magento/2.3-develop into magento-qwerty/MAGETWO-55809 | | | * 65a3242dda1 Merge branch 'MAGETWO-55809' of https://github.com/magento-qwerty/magento2ce into MAGETWO-55809 | | | | * d95ece7ef98 merge magento/2.3-develop into magento-qwerty/MAGETWO-55809 | | | | | * 4d2757d178f merge magento/2.3-develop into magento-qwerty/MAGETWO-55809 | | | | * | 50237fde35c Merge branch '2.3-develop' of https://github.com/magento/magento2ce into MAGETWO-55809 | | | * | | | | | | | | | d86efb669ba MAGETWO-55809: Eliminate @escapeNotVerified in Module Backend | | |/ / / / / / / / | |/| | | | | | | | | * | | | | | | | | 0f4f949db01 MAGETWO-55809: Eliminate @escapeNotVerified in Module Backend git checkout 2.3-develop git log --oneline --graph
  • 6. 6 TODO: example of perfect repository ¯_(ツ)_/¯
  • 7. * ceb65ff (HEAD -> prod, tag: 2.5.18) [CHE-300] Contingency Block * 6baf4b7 RIATCE-735: sticky PDP for a/b testing * 96fbf9f RIATCE-1511: fix order of loading elements on homepage * 84dcfce RIATCE-725: add search by image functionality * 799799c RIATCE-731: implement new PDP * decd884 RIATCS-1494: fix products count in title * beec966 RIATCS-1476: changes for SEO, add missing titles * 4268d31 RIATCS-1524: fix url key, do not replace with click url * ff4c1e6 (tag: 2.5.17.1) [CHE-639] STS Price Update * ba56e95 (tag: 2.5.17) [CHE-719] Performance * 0a76b68 [CHE-707] Saved Brasgpag Card alias fix * 30b9552 bug/VIT-334 Change query * 539046c [CHE-466] Customer access token * 2778ef8 [CHE-689] Valor de frete não aplicado ao cancelar cupom * 2f4c307 [CHE-712] Fix parcelamento por catálogo * ebb93cf Fixed virtual card token pattern checking * 303e93b bug/VIT-409 * 837d021 fixed look data reference used to add to cart * ebc6ad7 [CHE-652] Remove billet date calc * b2a849b RIATCS-1494: fix line below header * 2cc3920 RIATCS-1486: remove disabling old loader in js * ff48b07 RIATCS-1485: remove old loader * 4aa81a1 RIATCS-1401: change text in loader * 3c29d53 RIATCS-1423: merge branch sprint-40-final * 66a1b55 RIATCS-1476: change text in info_for_user section * fc980e7 RPV-82 - new front my orders * 3776b56 RIATCS-1475: add hart icon to gallery.phtm in Xumulus_FastGalleryLoad module * 467156b (tag: 2.5.17.3) RIATCS-1475 looks pdp issues * db6e6c7 RIATCS-1483: add functionality for new installment text working only on usual product 7 git checkout prod git log --oneline --graph
  • 8. REBASE Integrates changes from one branch into another. Rewrites the commit history in order to produce a straight, linear sequence of commits. 8
  • 9. REBASE WITH --onto 9 o---o---o---o---o master o---o---o---x---o stage o---o---o feature git rebase --onto master stage feature o---o---o---x---o master | | o'--o'--o' feature o---o---o---o---o stage git rebase [--onto <newbase>] [<oldest commit (excl)> [<newest commit>]]
  • 10. REBASE EVERYTHING ONTO ANYTHING 1 0 git rebase --onto master stage feature git rebase --onto HEAD~7 HEAD~4 HEAD git rebase --onto feature~8 feature~5 feature git rebase --onto 0f4db90 a14dab7 43ae1cd
  • 11. REBASE ONTO ITSELF 1 1 E---F---G---H---I---J topicA E---F---I---J topicA git rebase --onto F H J git rebase --onto F F J git rebase F E---F---I---J topicA
  • 13. REVERT Revert some existing commits by representing new commit 1 3
  • 14. RESET Reset current HEAD to the specified state 1 4 --soft --mixed (default) --hard index ✘ ✔ ✔ local tree ✘ ✘ ✔
  • 15. HARD RESET git reset --hard 1 5
  • 16. WARNING !!! Operations with commit history change commit hashes, hence if you previously pushed your changes to remote repository, after changing commits hashes you have to push it with --force option 1 6
  • 17. USEFUL RESOURCES - git <command> --help - https://git-scm.com/docs - `git status` suggestions 1 7
  • 18. REPOSITORY WITH CODE SAMPLES 1 8 https://github.com/magento-meetup-6/umbrella