Basic Operations

  1. A first commit
  2. A commit without staging
  3. Removing and moving files

A first commit

  • Close opened projects and open the Basics project
    The project contains an already initialized Git repository and Eclipse Java project
    new project
  • Open the Git Staging view in the Git perspective
  • Add the Main.java file to the staged changes Main.java > Add to Git Index
    add java file

    Note
    You can remove and add files from the Staged Changes through drag and drop.

    Note 2
    All the commands visible in the Git Staging are also availble in the explorers.

  • Create a new .gitignore file in the project root: Basics > New > File .
    Git ignore
  • Add /bin to this file to ignore all files in folder bin.
    GitIgnoreFile

    Note
    The EGit Ignore command, creates .gitignore files at various level of the Working Tree. It is cleaner to add files manually to a central .gitgnore.

  • Return to the Git Staging view
  • Add the new .gitignore file to the staged changes
  • Enter a commit message
  • Press Commit
    Commit

A commit without staging

  • Create a new Java file name NewClass. org.eclipsecon.hello > New > Class
    create NewClass
  • Open the commit GUI from an element of the explorer:Team > Commit Commit
  • Select the files you want to commit
  • Enter a commit message and commit you changes
    a second commit

Removing and moving files

  • As it is empty and has no point, delete the NewClass.java file NewClass.java > Delete > Yes
  • When creating the project, the read-me was wrongly name RAEDME.txt. Rename it to README.txt RAEDME.txt > Refactor > Rename > README.txt > Yes
  • Open the Git Staging view in the Git perspective. Eclipse has already added the changes to the Staged Changes a move and a remove
  • Commit these changes