SlideShare uma empresa Scribd logo
1 de 4
Baixar para ler offline
Interactive Rebase
In this exercise you learn how you can rewrite the local history before you share it with
others. After you have committed locally you can still change all commits in your local
feature branch. You will use the interactive rebase feature which helps you combining
different actions in one operation.
Preparation
Follow exercise “Merging, Rebasing and Conflict Resolution”. After the rebase you end up
with a branch which is two commits ahead of the remote branch origin/master.
Add two additional commits
● In the feature branch, add a commit with a change you do not need and with another
commit which should in fact be part of the commit “Add multiply operation”
● Now you realize that you also want to edit the commit message of the commit “Add
divide operation”
Interactive Rebase
Interactive Rebase is a very powerful operation which allows to rewrite the history of a
branch. You can select a set of commits and specify for each one how it should be handled.
You can edit the commit message, edit the commit, skip the commit, change the order of
commits or squash commits together. We will try out some of the options in this exercise.
● Click “Rebase interactive” on the parent of the first commit you want to change in
order to start interactive rebase:
● Now open the “Git Interactive Rebase” View
The commits are presented in the order they will be processed by interactive rebase.
Change the action for each of the commits like shown here:
● Click on the “Start” button
The list of actions is processed from top to bottom.
● The first commit has the action REWORD. EGit opens a dialog where you can edit
the commit message. Press OK. The commit is replaced by a new one which has the
new commit message.
● The next commit is just picked. That means, that EGit cherry-picks this commit as
a successor of the first reworded commit which contains the same changes as the
picked commit.
● The next commit is skipped (removed on the branch rewritten by interactive rebase).
● The list of actions is updated during the Interactive Rebase:
● The last commit should be squashed with its predecessor commit. That means that a
new commit is created which replaces the predecessor and combines the changes of
both old commits. You can edit the commit message of the new commit in a dialog.
Note that the action FIXUP would also have combined the two commits but would
have silently taken the commit message of the first commit.
● As a result the history should look like this:
Note that the old “Add divide operation” commit is still in the history because the
branch “addDivideOperation” points to it.
Note: do not rewrite commits which have already been published (reached a branch on
the server) since other developers may have already based new changes on them. Use
interactive rebase only on local changes or on changes which have been pushed for review
(e.g. if you are using Gerrit for code review) but have not yet been accepted and merged to
a branch (by “submit” in Gerrit).
Copyright © 2014 by C. Halstrick, E. Kempin, S. Lay, S. Zivkov, M. Sohn

Mais conteúdo relacionado

Semelhante a Git Tutorial EclipseCon France 2014 - Git Exercise 06 - interactive rebase

Git Branching and Merging.pptx
Git Branching and Merging.pptxGit Branching and Merging.pptx
Git Branching and Merging.pptx
tapanvyas11
 
Checkitmobile advanced git
Checkitmobile advanced gitCheckitmobile advanced git
Checkitmobile advanced git
Gerrit Wanderer
 
Checkitmobile - using Git for development
Checkitmobile - using Git for developmentCheckitmobile - using Git for development
Checkitmobile - using Git for development
Gerrit Wanderer
 
BSADD-Git-TRAINING
BSADD-Git-TRAININGBSADD-Git-TRAINING
BSADD-Git-TRAINING
bsadd
 

Semelhante a Git Tutorial EclipseCon France 2014 - Git Exercise 06 - interactive rebase (20)

Git Tutorial EclipseCon France 2014 - Git Exercise 04 - merging rebasing and ...
Git Tutorial EclipseCon France 2014 - Git Exercise 04 - merging rebasing and ...Git Tutorial EclipseCon France 2014 - Git Exercise 04 - merging rebasing and ...
Git Tutorial EclipseCon France 2014 - Git Exercise 04 - merging rebasing and ...
 
Git Branching and Merging.pptx
Git Branching and Merging.pptxGit Branching and Merging.pptx
Git Branching and Merging.pptx
 
GIT Rebasing and Merging
GIT Rebasing and MergingGIT Rebasing and Merging
GIT Rebasing and Merging
 
E caregitpresentation
E caregitpresentationE caregitpresentation
E caregitpresentation
 
Checkitmobile advanced git
Checkitmobile advanced gitCheckitmobile advanced git
Checkitmobile advanced git
 
Git Tutorial EclipseCon France 2014 - Gerrit Exercise 5 - improve a change
Git Tutorial EclipseCon France 2014 - Gerrit Exercise 5 - improve a changeGit Tutorial EclipseCon France 2014 - Gerrit Exercise 5 - improve a change
Git Tutorial EclipseCon France 2014 - Gerrit Exercise 5 - improve a change
 
Introduction to Git
Introduction to GitIntroduction to Git
Introduction to Git
 
Application of Git Revert in different situation
Application of Git Revert in different situationApplication of Git Revert in different situation
Application of Git Revert in different situation
 
Git Best Practices.pptx
Git Best Practices.pptxGit Best Practices.pptx
Git Best Practices.pptx
 
Lesson 0.5 Introduction to Git (1).pptx
Lesson 0.5 Introduction to Git (1).pptxLesson 0.5 Introduction to Git (1).pptx
Lesson 0.5 Introduction to Git (1).pptx
 
Lesson 0.5 Introduction to Git (1).pptx
Lesson 0.5 Introduction to Git (1).pptxLesson 0.5 Introduction to Git (1).pptx
Lesson 0.5 Introduction to Git (1).pptx
 
Version Control System - Git
Version Control System - GitVersion Control System - Git
Version Control System - Git
 
Git and GitHub
Git and GitHubGit and GitHub
Git and GitHub
 
Git Tutorial EclipseCon France 2014 - Gerrit Exercise 4 - review change
Git Tutorial EclipseCon France 2014 - Gerrit Exercise 4 - review changeGit Tutorial EclipseCon France 2014 - Gerrit Exercise 4 - review change
Git Tutorial EclipseCon France 2014 - Gerrit Exercise 4 - review change
 
Checkitmobile - using Git for development
Checkitmobile - using Git for developmentCheckitmobile - using Git for development
Checkitmobile - using Git for development
 
Learning Robotic Process Automation-81-167
Learning Robotic Process Automation-81-167Learning Robotic Process Automation-81-167
Learning Robotic Process Automation-81-167
 
Mastering GIT
Mastering GITMastering GIT
Mastering GIT
 
Lab3 RTC Source Control
Lab3 RTC Source ControlLab3 RTC Source Control
Lab3 RTC Source Control
 
BSADD-Git-TRAINING
BSADD-Git-TRAININGBSADD-Git-TRAINING
BSADD-Git-TRAINING
 
Bsadd training-git
Bsadd training-gitBsadd training-git
Bsadd training-git
 

Mais de msohn

Code Matters - Eclipse Hackers Git Guide - EclipseCon France 2014
Code Matters - Eclipse Hackers Git Guide - EclipseCon France 2014Code Matters - Eclipse Hackers Git Guide - EclipseCon France 2014
Code Matters - Eclipse Hackers Git Guide - EclipseCon France 2014
msohn
 

Mais de msohn (20)

Project Gardener - EclipseCon Europe - 2018-10-23
Project Gardener - EclipseCon Europe - 2018-10-23Project Gardener - EclipseCon Europe - 2018-10-23
Project Gardener - EclipseCon Europe - 2018-10-23
 
News from Git in Eclipse - EclipseCon EU - 2016-10-26
News from Git in Eclipse - EclipseCon EU - 2016-10-26News from Git in Eclipse - EclipseCon EU - 2016-10-26
News from Git in Eclipse - EclipseCon EU - 2016-10-26
 
Git journey from mars to neon EclipseCon North America - 2016-03-08
Git journey from mars to neon   EclipseCon North America - 2016-03-08Git journey from mars to neon   EclipseCon North America - 2016-03-08
Git journey from mars to neon EclipseCon North America - 2016-03-08
 
Versioning large binary files with JGit, EGit and Gerrit
Versioning large binary files with JGit, EGit and GerritVersioning large binary files with JGit, EGit and Gerrit
Versioning large binary files with JGit, EGit and Gerrit
 
News from Git in Eclipse - EclipseCon 2015 Europe
News from Git in Eclipse - EclipseCon 2015 EuropeNews from Git in Eclipse - EclipseCon 2015 Europe
News from Git in Eclipse - EclipseCon 2015 Europe
 
Git missiontomars 2015-03-10
Git missiontomars 2015-03-10Git missiontomars 2015-03-10
Git missiontomars 2015-03-10
 
News from EGit - Talk EclipseCon Europe 2014 - Ludwigsburg
News from EGit - Talk EclipseCon Europe 2014 - LudwigsburgNews from EGit - Talk EclipseCon Europe 2014 - Ludwigsburg
News from EGit - Talk EclipseCon Europe 2014 - Ludwigsburg
 
Git Tutorial EclipseCon France 2014 - Gerrit Exercise 9 - starting demo gerrit
Git Tutorial EclipseCon France 2014 - Gerrit Exercise 9 - starting demo gerritGit Tutorial EclipseCon France 2014 - Gerrit Exercise 9 - starting demo gerrit
Git Tutorial EclipseCon France 2014 - Gerrit Exercise 9 - starting demo gerrit
 
Git Tutorial EclipseCon France 2014 - Gerrit Exercise 7 - new changescreen
Git Tutorial EclipseCon France 2014 - Gerrit Exercise 7 - new changescreenGit Tutorial EclipseCon France 2014 - Gerrit Exercise 7 - new changescreen
Git Tutorial EclipseCon France 2014 - Gerrit Exercise 7 - new changescreen
 
Git Tutorial EclipseCon France 2014 - Gerrit Exercise 3 - push change to gerrit
Git Tutorial EclipseCon France 2014 - Gerrit Exercise 3 - push change to gerritGit Tutorial EclipseCon France 2014 - Gerrit Exercise 3 - push change to gerrit
Git Tutorial EclipseCon France 2014 - Gerrit Exercise 3 - push change to gerrit
 
Git Tutorial EclipseCon France 2014 - Gerrit Exercise 2 - fetch the latest state
Git Tutorial EclipseCon France 2014 - Gerrit Exercise 2 - fetch the latest stateGit Tutorial EclipseCon France 2014 - Gerrit Exercise 2 - fetch the latest state
Git Tutorial EclipseCon France 2014 - Gerrit Exercise 2 - fetch the latest state
 
Git Tutorial EclipseCon France 2014 - Gerrit Exercise 1 - configure for gerrit
Git Tutorial EclipseCon France 2014 - Gerrit Exercise 1 - configure for gerritGit Tutorial EclipseCon France 2014 - Gerrit Exercise 1 - configure for gerrit
Git Tutorial EclipseCon France 2014 - Gerrit Exercise 1 - configure for gerrit
 
Git Tutorial EclipseCon France 2014 - Gerrit Exercise 8 - view gerrit review ...
Git Tutorial EclipseCon France 2014 - Gerrit Exercise 8 - view gerrit review ...Git Tutorial EclipseCon France 2014 - Gerrit Exercise 8 - view gerrit review ...
Git Tutorial EclipseCon France 2014 - Gerrit Exercise 8 - view gerrit review ...
 
Git Tutorial EclipseCon France 2014 - Git Exercise 07 - git blame
Git Tutorial EclipseCon France 2014 - Git Exercise 07 - git blameGit Tutorial EclipseCon France 2014 - Git Exercise 07 - git blame
Git Tutorial EclipseCon France 2014 - Git Exercise 07 - git blame
 
Git Tutorial EclipseCon France 2014 - Git Exercise 05 - history view
Git Tutorial EclipseCon France 2014 - Git Exercise 05 - history viewGit Tutorial EclipseCon France 2014 - Git Exercise 05 - history view
Git Tutorial EclipseCon France 2014 - Git Exercise 05 - history view
 
Git Tutorial EclipseCon France 2014 - Git Exercise 01 - installation and conf...
Git Tutorial EclipseCon France 2014 - Git Exercise 01 - installation and conf...Git Tutorial EclipseCon France 2014 - Git Exercise 01 - installation and conf...
Git Tutorial EclipseCon France 2014 - Git Exercise 01 - installation and conf...
 
Code Matters - Eclipse Hackers Git Guide - EclipseCon France 2014
Code Matters - Eclipse Hackers Git Guide - EclipseCon France 2014Code Matters - Eclipse Hackers Git Guide - EclipseCon France 2014
Code Matters - Eclipse Hackers Git Guide - EclipseCon France 2014
 
Interactive Rebase with EGit
Interactive Rebase with EGitInteractive Rebase with EGit
Interactive Rebase with EGit
 
EGit 3.0 and beyond
EGit 3.0 and beyondEGit 3.0 and beyond
EGit 3.0 and beyond
 
Cool new stuff in JGit and EGit - Eclipse Democamp Munich 2013-06-12
Cool new stuff in JGit and EGit - Eclipse Democamp Munich 2013-06-12Cool new stuff in JGit and EGit - Eclipse Democamp Munich 2013-06-12
Cool new stuff in JGit and EGit - Eclipse Democamp Munich 2013-06-12
 

Último

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
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
Health
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 

Último (20)

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...
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.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
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
%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
 
BUS PASS MANGEMENT SYSTEM USING PHP.pptx
BUS PASS MANGEMENT SYSTEM USING PHP.pptxBUS PASS MANGEMENT SYSTEM USING PHP.pptx
BUS PASS MANGEMENT SYSTEM USING PHP.pptx
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdfAzure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
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 🔝✔️✔️
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
ManageIQ - Sprint 236 Review - Slide Deck
ManageIQ - Sprint 236 Review - Slide DeckManageIQ - Sprint 236 Review - Slide Deck
ManageIQ - Sprint 236 Review - Slide Deck
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
 
LEVEL 5 - SESSION 1 2023 (1).pptx - PDF 123456
LEVEL 5   - SESSION 1 2023 (1).pptx - PDF 123456LEVEL 5   - SESSION 1 2023 (1).pptx - PDF 123456
LEVEL 5 - SESSION 1 2023 (1).pptx - PDF 123456
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 

Git Tutorial EclipseCon France 2014 - Git Exercise 06 - interactive rebase

  • 1. Interactive Rebase In this exercise you learn how you can rewrite the local history before you share it with others. After you have committed locally you can still change all commits in your local feature branch. You will use the interactive rebase feature which helps you combining different actions in one operation. Preparation Follow exercise “Merging, Rebasing and Conflict Resolution”. After the rebase you end up with a branch which is two commits ahead of the remote branch origin/master. Add two additional commits ● In the feature branch, add a commit with a change you do not need and with another commit which should in fact be part of the commit “Add multiply operation” ● Now you realize that you also want to edit the commit message of the commit “Add divide operation” Interactive Rebase Interactive Rebase is a very powerful operation which allows to rewrite the history of a branch. You can select a set of commits and specify for each one how it should be handled. You can edit the commit message, edit the commit, skip the commit, change the order of commits or squash commits together. We will try out some of the options in this exercise.
  • 2. ● Click “Rebase interactive” on the parent of the first commit you want to change in order to start interactive rebase: ● Now open the “Git Interactive Rebase” View The commits are presented in the order they will be processed by interactive rebase. Change the action for each of the commits like shown here: ● Click on the “Start” button The list of actions is processed from top to bottom. ● The first commit has the action REWORD. EGit opens a dialog where you can edit the commit message. Press OK. The commit is replaced by a new one which has the new commit message.
  • 3. ● The next commit is just picked. That means, that EGit cherry-picks this commit as a successor of the first reworded commit which contains the same changes as the picked commit. ● The next commit is skipped (removed on the branch rewritten by interactive rebase). ● The list of actions is updated during the Interactive Rebase: ● The last commit should be squashed with its predecessor commit. That means that a new commit is created which replaces the predecessor and combines the changes of both old commits. You can edit the commit message of the new commit in a dialog. Note that the action FIXUP would also have combined the two commits but would have silently taken the commit message of the first commit.
  • 4. ● As a result the history should look like this: Note that the old “Add divide operation” commit is still in the history because the branch “addDivideOperation” points to it. Note: do not rewrite commits which have already been published (reached a branch on the server) since other developers may have already based new changes on them. Use interactive rebase only on local changes or on changes which have been pushed for review (e.g. if you are using Gerrit for code review) but have not yet been accepted and merged to a branch (by “submit” in Gerrit). Copyright © 2014 by C. Halstrick, E. Kempin, S. Lay, S. Zivkov, M. Sohn