SlideShare a Scribd company logo
Develop a feature/bug fix
In this exercise you will learn how to develop a new feature using EGit. Using a new local
branch for each new change (feature or bug fix) is what we recommend.
● Create a local Feature Branch
The development of a new feature (or bug-fix) should normally only depend on the
submitted state of the project (and not depend on pending changes that might or might
not pass the code review). This is why every new feature or bug-fix should be developed
in isolation on its own branch which is usually created based on the latest state of the
master branch available on the server (this is the remote tracking branch origin/
master in your local clone).
○ Go to the History View
○ Select the latest commit which has the label ‘origin/master’ and
click Create Branch..
○ in the “New Branch” dialog
■ enter a name for the local feature branch into the “Branch Name” field
(this is just a local name that is not exposed to anybody else)
■ keep the Pull Strategy Merge
■ keep Checkout new branch selected
■ confirm the dialog by clicking on Finish
○ This creates and checks out the new branch
● Develop the feature
Simply start editing the source code and implement the feature. The example project
implements a simple calculator, you may want to add an operation (create a new class
Divide.java in package org.eclipse.example.calc.internal.operations
and add a corresponding line to method setupDefaultOperations in class
Calculator) or polish its SWT or Swing UI..
● Test your feature
Run the unit tests. To keep the tutorial setup simple there are only unit tests for the logic
but no UI tests.
● Commit your changes locally
Now you want to create a new version of the local repository in your current feature
branch containing your changes. This is called “commit”.
There are two ways to perform a commit: with the Commit Dialog or from the Staging
View. In this exercise we will use the Staging View.
● Open the Git Staging view and inspect the status
Open the staging view by selecting Window > Show View > Other… > Git Staging. This
view presents which files you have touched and which files will be in the next commit.
“Unstaged Changes” lists those changes which you have done locally but which you
have not yet added to the index. “Staged Changes” list those changes which you already
have added to the index. You can drag and drop files from one area to the other.
● The Git Staging view should list two files “Calculator.java” and “Divide.java”. Double-click
on “Calculator.java” to inspect which changes you have done.
● Drag and drop “Calculator.java” and “Divide.java” to the Staged Changes area to mark
that they should be included in the next commit.
● Do another change in the class “Divide.java”. for example fix the copyright header. Now
you have two entries for the file “Divide.java”. The next commit would only contain the
changes which you have already staged.
● Enter a commit message (explaining why the change was done is more important than
what was done since this can anyway be seen from the file diffs)
● Verify that “Author” and “Committer” contain both your full name and your correct e-mail
address in the following format:
John Doe <john.doe@example.org>
● If author and committer are not preset correctly you need to change the Git configuration
parameters user.name and/or user.email. In this case cancel the dialog and open
Preferences > Team > Git > Configuration > User Setting and correct the values for
user.name and user.email .
● The Change-Id line is created when you select the button with the Gerrit icon ( ). It
is needed for the Gerrit exercises. The button is automatically selected if you cloned a
repository from Gerrit as described in exercise 1. Select the button if you want to push
the commit to Gerrit later on. You can also add the Change-Id line later.
● If you want to push the commit to an Eclipse repository later also click the “Add signed-
off-by” button since Eclipse uses this as your confirmation that you contribute the change
under the Contribution License Agreement (CLA). This adds a footer which will be
validated against the email address registered for your Eclipse account when you push
the commit to an Eclipse repository Signed-of-by: John Doe <
john.doe@example.org>
● Click Commit. As result your changes are locally committed.
Copyright © 2014 by C. Halstrick, E. Kempin, S. Lay, S. Zivkov, M. Sohn

More Related Content

PDF
Git Tutorial EclipseCon France 2014 - Git Exercise 04 - merging rebasing and ...
PDF
Git Tutorial EclipseCon France 2014 - Git Exercise 03 - work on branches in p...
PDF
Git Tutorial EclipseCon France 2014 - Gerrit Exercise 4 - review change
PDF
Git Tutorial EclipseCon France 2014 - Gerrit Exercise 5 - improve a change
PPTX
Ao6 collaboratively review
DOCX
Cascade Receiving (Oracle- Purchasing)
DOCX
Substitute Receipt (Oracle-Purchasing R12.2.0)
PDF
Web services in asp.net
Git Tutorial EclipseCon France 2014 - Git Exercise 04 - merging rebasing and ...
Git Tutorial EclipseCon France 2014 - Git Exercise 03 - work on branches in p...
Git Tutorial EclipseCon France 2014 - Gerrit Exercise 4 - review change
Git Tutorial EclipseCon France 2014 - Gerrit Exercise 5 - improve a change
Ao6 collaboratively review
Cascade Receiving (Oracle- Purchasing)
Substitute Receipt (Oracle-Purchasing R12.2.0)
Web services in asp.net

What's hot (8)

PDF
How to Use Toggl -Jennefer Mercado- Empress of Helping Hand
DOCX
Providing sl no in Gridview in Dot Net
PPTX
Eclipse e git
PPTX
Project Hosting by Google
PDF
How to Use Toggl
DOCX
How to add sql server table into dot net web page (Gridview)
DOCX
How to add sorting and pagers to grid view
PPT
ASP.NET Session 5
How to Use Toggl -Jennefer Mercado- Empress of Helping Hand
Providing sl no in Gridview in Dot Net
Eclipse e git
Project Hosting by Google
How to Use Toggl
How to add sql server table into dot net web page (Gridview)
How to add sorting and pagers to grid view
ASP.NET Session 5
Ad

Similar to Git Tutorial EclipseCon France 2014 - Git Exercise 02 - develop a feature (20)

PPTX
Git Branching and Merging.pptx
PPTX
wdt_09.pptx
PDF
Git Tutorial EclipseCon France 2014 - Gerrit Exercise 7 - new changescreen
PPT
Dreamforce 13 developer session: Git for Force.com developers
PDF
Introduction to Git for Force.com Developers
PDF
Git Tutorial EclipseCon France 2014 - Git Exercise 06 - interactive rebase
PPTX
E caregitpresentation
PPTX
Git Tutorials Git vs GitHub.pptx
PPTX
Setting up Git.pptx
DOCX
Chicago alm user group git demo script and notes
PDF
Introducing Git and git flow
PPTX
Git hub plugin setup and working with Git hub on anypoint studio
PPTX
Streamlining React Component Development and Sharing with bit.pptx
PPTX
Git and Github Version control Questions
PPTX
Github plugin setup in anypointstudio
PPTX
Github plugin setup in anypoint studio
 
PPTX
Github plugin setup in anypoint studio
PPTX
Github plugin setup in anypoint studio
PPTX
GDSC Git event 2023.pptx
PPTX
Git and git hub basics
Git Branching and Merging.pptx
wdt_09.pptx
Git Tutorial EclipseCon France 2014 - Gerrit Exercise 7 - new changescreen
Dreamforce 13 developer session: Git for Force.com developers
Introduction to Git for Force.com Developers
Git Tutorial EclipseCon France 2014 - Git Exercise 06 - interactive rebase
E caregitpresentation
Git Tutorials Git vs GitHub.pptx
Setting up Git.pptx
Chicago alm user group git demo script and notes
Introducing Git and git flow
Git hub plugin setup and working with Git hub on anypoint studio
Streamlining React Component Development and Sharing with bit.pptx
Git and Github Version control Questions
Github plugin setup in anypointstudio
Github plugin setup in anypoint studio
 
Github plugin setup in anypoint studio
Github plugin setup in anypoint studio
GDSC Git event 2023.pptx
Git and git hub basics
Ad

More from msohn (20)

PPTX
Project Gardener - EclipseCon Europe - 2018-10-23
PDF
News from Git in Eclipse - EclipseCon EU - 2016-10-26
PDF
Git journey from mars to neon EclipseCon North America - 2016-03-08
PDF
Versioning large binary files with JGit, EGit and Gerrit
PDF
News from Git in Eclipse - EclipseCon 2015 Europe
PPTX
Git missiontomars 2015-03-10
PPTX
News from EGit - Talk EclipseCon Europe 2014 - Ludwigsburg
PDF
Git Tutorial EclipseCon France 2014 - Gerrit Exercise 9 - starting demo gerrit
PDF
Git Tutorial EclipseCon France 2014 - Gerrit Exercise 6 - submit a change
PDF
Git Tutorial EclipseCon France 2014 - Gerrit Exercise 3 - push change to gerrit
PDF
Git Tutorial EclipseCon France 2014 - Gerrit Exercise 2 - fetch the latest state
PDF
Git Tutorial EclipseCon France 2014 - Gerrit Exercise 1 - configure for gerrit
PDF
Git Tutorial EclipseCon France 2014 - Gerrit Exercise 8 - view gerrit review ...
PDF
Git Tutorial EclipseCon France 2014 - Git Exercise 07 - git blame
PDF
Git Tutorial EclipseCon France 2014 - Git Exercise 05 - history view
PDF
Git Tutorial EclipseCon France 2014 - Git Exercise 01 - installation and conf...
PDF
Code Matters - Eclipse Hackers Git Guide - EclipseCon France 2014
PPTX
Interactive Rebase with EGit
PDF
EGit 3.0 and beyond
PPTX
Cool new stuff in JGit and EGit - Eclipse Democamp Munich 2013-06-12
Project Gardener - EclipseCon Europe - 2018-10-23
News from Git in Eclipse - EclipseCon EU - 2016-10-26
Git journey from mars to neon EclipseCon North America - 2016-03-08
Versioning large binary files with JGit, EGit and Gerrit
News from Git in Eclipse - EclipseCon 2015 Europe
Git missiontomars 2015-03-10
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 6 - submit a change
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 1 - configure for gerrit
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 05 - history view
Git Tutorial EclipseCon France 2014 - Git Exercise 01 - installation and conf...
Code Matters - Eclipse Hackers Git Guide - EclipseCon France 2014
Interactive Rebase with EGit
EGit 3.0 and beyond
Cool new stuff in JGit and EGit - Eclipse Democamp Munich 2013-06-12

Recently uploaded (20)

PPTX
Why Generative AI is the Future of Content, Code & Creativity?
PDF
Wondershare Filmora 15 Crack With Activation Key [2025
PPTX
Reimagine Home Health with the Power of Agentic AI​
PPTX
Embracing Complexity in Serverless! GOTO Serverless Bengaluru
PDF
iTop VPN Crack Latest Version Full Key 2025
PPTX
CHAPTER 2 - PM Management and IT Context
PPTX
Computer Software and OS of computer science of grade 11.pptx
PPTX
Advanced SystemCare Ultimate Crack + Portable (2025)
PDF
iTop VPN 6.5.0 Crack + License Key 2025 (Premium Version)
PPTX
Weekly report ppt - harsh dattuprasad patel.pptx
PPTX
history of c programming in notes for students .pptx
PPTX
Log360_SIEM_Solutions Overview PPT_Feb 2020.pptx
PDF
CCleaner Pro 6.38.11537 Crack Final Latest Version 2025
PDF
Website Design Services for Small Businesses.pdf
PDF
How to Make Money in the Metaverse_ Top Strategies for Beginners.pdf
PDF
Navsoft: AI-Powered Business Solutions & Custom Software Development
PDF
Cost to Outsource Software Development in 2025
PDF
Product Update: Alluxio AI 3.7 Now with Sub-Millisecond Latency
PPTX
AMADEUS TRAVEL AGENT SOFTWARE | AMADEUS TICKETING SYSTEM
PDF
wealthsignaloriginal-com-DS-text-... (1).pdf
Why Generative AI is the Future of Content, Code & Creativity?
Wondershare Filmora 15 Crack With Activation Key [2025
Reimagine Home Health with the Power of Agentic AI​
Embracing Complexity in Serverless! GOTO Serverless Bengaluru
iTop VPN Crack Latest Version Full Key 2025
CHAPTER 2 - PM Management and IT Context
Computer Software and OS of computer science of grade 11.pptx
Advanced SystemCare Ultimate Crack + Portable (2025)
iTop VPN 6.5.0 Crack + License Key 2025 (Premium Version)
Weekly report ppt - harsh dattuprasad patel.pptx
history of c programming in notes for students .pptx
Log360_SIEM_Solutions Overview PPT_Feb 2020.pptx
CCleaner Pro 6.38.11537 Crack Final Latest Version 2025
Website Design Services for Small Businesses.pdf
How to Make Money in the Metaverse_ Top Strategies for Beginners.pdf
Navsoft: AI-Powered Business Solutions & Custom Software Development
Cost to Outsource Software Development in 2025
Product Update: Alluxio AI 3.7 Now with Sub-Millisecond Latency
AMADEUS TRAVEL AGENT SOFTWARE | AMADEUS TICKETING SYSTEM
wealthsignaloriginal-com-DS-text-... (1).pdf

Git Tutorial EclipseCon France 2014 - Git Exercise 02 - develop a feature

  • 1. Develop a feature/bug fix In this exercise you will learn how to develop a new feature using EGit. Using a new local branch for each new change (feature or bug fix) is what we recommend. ● Create a local Feature Branch The development of a new feature (or bug-fix) should normally only depend on the submitted state of the project (and not depend on pending changes that might or might not pass the code review). This is why every new feature or bug-fix should be developed in isolation on its own branch which is usually created based on the latest state of the master branch available on the server (this is the remote tracking branch origin/ master in your local clone). ○ Go to the History View ○ Select the latest commit which has the label ‘origin/master’ and
  • 2. click Create Branch.. ○ in the “New Branch” dialog ■ enter a name for the local feature branch into the “Branch Name” field (this is just a local name that is not exposed to anybody else) ■ keep the Pull Strategy Merge ■ keep Checkout new branch selected
  • 3. ■ confirm the dialog by clicking on Finish ○ This creates and checks out the new branch ● Develop the feature Simply start editing the source code and implement the feature. The example project implements a simple calculator, you may want to add an operation (create a new class Divide.java in package org.eclipse.example.calc.internal.operations
  • 4. and add a corresponding line to method setupDefaultOperations in class Calculator) or polish its SWT or Swing UI.. ● Test your feature Run the unit tests. To keep the tutorial setup simple there are only unit tests for the logic but no UI tests. ● Commit your changes locally Now you want to create a new version of the local repository in your current feature branch containing your changes. This is called “commit”. There are two ways to perform a commit: with the Commit Dialog or from the Staging View. In this exercise we will use the Staging View. ● Open the Git Staging view and inspect the status Open the staging view by selecting Window > Show View > Other… > Git Staging. This view presents which files you have touched and which files will be in the next commit. “Unstaged Changes” lists those changes which you have done locally but which you have not yet added to the index. “Staged Changes” list those changes which you already have added to the index. You can drag and drop files from one area to the other. ● The Git Staging view should list two files “Calculator.java” and “Divide.java”. Double-click on “Calculator.java” to inspect which changes you have done.
  • 5. ● Drag and drop “Calculator.java” and “Divide.java” to the Staged Changes area to mark that they should be included in the next commit. ● Do another change in the class “Divide.java”. for example fix the copyright header. Now you have two entries for the file “Divide.java”. The next commit would only contain the changes which you have already staged.
  • 6. ● Enter a commit message (explaining why the change was done is more important than what was done since this can anyway be seen from the file diffs) ● Verify that “Author” and “Committer” contain both your full name and your correct e-mail address in the following format: John Doe <john.doe@example.org> ● If author and committer are not preset correctly you need to change the Git configuration parameters user.name and/or user.email. In this case cancel the dialog and open Preferences > Team > Git > Configuration > User Setting and correct the values for user.name and user.email . ● The Change-Id line is created when you select the button with the Gerrit icon ( ). It is needed for the Gerrit exercises. The button is automatically selected if you cloned a repository from Gerrit as described in exercise 1. Select the button if you want to push the commit to Gerrit later on. You can also add the Change-Id line later. ● If you want to push the commit to an Eclipse repository later also click the “Add signed- off-by” button since Eclipse uses this as your confirmation that you contribute the change under the Contribution License Agreement (CLA). This adds a footer which will be validated against the email address registered for your Eclipse account when you push the commit to an Eclipse repository Signed-of-by: John Doe < john.doe@example.org> ● Click Commit. As result your changes are locally committed. Copyright © 2014 by C. Halstrick, E. Kempin, S. Lay, S. Zivkov, M. Sohn