Branches

  1. Implements a feature
  2. Fix some issues
  3. Implements another feature
  4. Merge
  5. Rebase

Implements a feature

  • Close opened projects and open the HelloWorld-5 project
  • Switch to Java perspective.
    Initial Project
  • Hint
    It's always a good idea to develop your features into dedicated branches.

    Create the GreetingService branch.
    Choose Create Branch... from History contextual menu.
    Or choose Team > Switch To > New Branch... in the Package Explorer contextual menu.
    Create Branch
  • The current branch is GreetingService.
    Current Branch
  • Create the mighty GreetingService class and Commit.
    package org.eclipsecon.egit.exo5;
    
    /**
     * The GreetingService class provide greeting messages
     */
    public class GreetingService {
    
    	/**
    	 * Return default greeting message
    	 * @return the greeting message
    	 */
    	public String greeting() {
    		return "Hello World !";
    	}
    }
  • Update main with the GreetingService and Commit.
    public static void main(String[] args) {
    	GreetingService greetingService = new GreetingService();
    	System.out.println(greetingService.greeting());
    }
  • Feature Greeting Service

Fix some issues

  • Checkout to the master branch to fix these bugs.
    Choose Checkout from the History view on the master branch.
    Or choose Team > Switch To > master from Package Explorer.
    Checkout Master
  • Fix the Javadoc and Commit.
    /**
     * Program entry point
     * @param args arguments (Optional)
     */
  • Fix .gitignore.

    Note
    Use Package Explorer Filters... into the view menu to show dot-files.
    Or go into Git Repository Exploring to edit the file into the Working Directory.

    Fix issues

Implements another feature

  • Create the Documentation branch.
  • Create the README.md file, and Commit.
  • Fill the documentation and Commit.
    Add Documentation

Merge

  • Checkout to the master branch
  • Merge master with GreetingService
    Choose Team > Merge... from Package Explorer and select the GreetingService branch.
    Or choose Merge on the GreetingService branch of the History view.
    Merge
  • Note
    You can disable Show all Branches and Tags to have a clearer view.

    Merge

Rebase

  • Checkout to Documentation branch
  • Rebase on top of master.
    Choose Team > Rebase... from Package Explorer and select the master branch.
    Or choose Rebase on Top of on the master branch of the History view.
  • Rebase