Skip to main content

Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

EGit/User Guide/Getting Started

EGit
Website
Download
Community
Mailing ListForumsIRCmattermost
Issues
OpenHelp WantedBug Day
Contribute
Browse SourceProject Set File

Getting Started

Create a new Java project "HelloWorld"

01-CreateNewJavaProject.png

Select "File" -> "Team" -> "Share Project"

02-TeamShareProject.png

Select repository type "Git" and click "Next"

03-SelectRepositoryTypeGit.png

To configure the Git repository select the new Eclipse project HelloWorld

04-SelectProjectToConfigureGitRepository.png

Click "Create" to initialize a new Git repository for the HelloWorld project. If your project already resides in the working tree of an exisiting GIT repository the repository is chosen automatically.

05-CreateNewGitRepository.png

Click "Finish" to close the wizard.

The decorator text "[master]" behind the project shows that this project is tracked in a repository on the master branch and the question mark decorators show that the ".classpath" and ".project" files are not yet under version control

06-NewGitRepository.png

Select "Team" -> "Add to version control" on the project node

07-AddToVersionControl.png

The plus decorators show that now the ".classpath" and ".project" files are added to version control

Create a file .gitignore in the project folder with the following content:

bin

This excludes the bin folder from GIT's list of untracked files. Add .gitignore to version control.

08-AddedToVersionControl.png

The file under ".settings" is not added to version control since it is by default on the list of ignored resources which can be changed in "Preferences" -> "Team" -> "Ignored Resources"

09-IgnoredResources.png

Select "Team" -> "Commit" from the context menu on the project

10-ClickCommit.png

Enter a commit message explaining your change, the first line (separated by an empty line) will become the short log for this commit. By default the author and committer are taken from the .gitconfig file in your home directory. You may check the checkbox "Add Signed-of-by" to add a Signed-off-by tag. If you are committing the change of another author you may alter the author field to give the name and email address of the author. Click "Commit" to commit your first change.

11-CommitDialog.png

Note that the decorators of the committed files changed.

12-CommittedFiles.png

Select "Team" -> "Show in Resource History" from the context menu to inspect the history of a resource

13-SelectResourceHistory.png

14-ResourceHistory.png

Create a new Java class HelloWorld and implement it, then add it to version control and commit your change. Improve your implementation and commit the improved class, the resource history should now show 2 commits for this class.

15-FirstImplementation.png

Double click "src/HelloWorld.java" in the Resource History View to open your last committed change in the Eclipse compare view

16-ShowChange.png

Back to the top