Playing with Diff

  • Close opened projects and open the HelloWorld-4 project
    The project contains a Git repository with a short history.
  • Modify the Main class to use String.format() instead of MessageFormat.format(). Replace
    System.out.println(MessageFormat.format("Hi {0}!",name));
    with
    System.out.println(String.format("Hi %s!",name));
  • The file is now both staged and modified
    Staging View
  • Right-click on Main.java and click on Compare with > Git Index to display the diff between the working version and the staged version of the file
    Diff with staging.

    Note
    You can also display this diff by double-clicking the file name in the Git Staging view.

  • In the same menu, click on Compare with > HEAD Revision to display the diff between the working version and the last comitted version of the file
    Diff with HEAD.
  • Still in the same menu, click on Compare with > Commit....
  • Select the Created Project commit to display the diff between the working version and version of the filein that commit
    Commit Selection
    Diff with commit.
  • The Compare With menu contains other types of diff, try some of the other options.