using git inside eclipse, pushing/cloning from github

125
Java for Hydrologists Some useful applications of EGit R. Rigon, F. Serafin R.Rigon - Il tavolo di lavoro di Remo Wolf March 20, 2014

Upload: abouthydrology-slides

Post on 11-May-2015

686 views

Category:

Education


1 download

DESCRIPTION

It explain how to setup a local git repository and a github repository to use version control of Java development.

TRANSCRIPT

Page 1: Using Git Inside Eclipse, Pushing/Cloning from GitHub

Java for HydrologistsSome useful applications of EGit

R. Rigon, F. Serafin

R.R

igon

-Il

tavo

lodi

lavo

rodi

Rem

oW

olf

March 20, 2014

Page 2: Using Git Inside Eclipse, Pushing/Cloning from GitHub

Introduction Push new local project on remote Clone remote repo in your local Push modifies of cloned project

Objectives

Some useful applications of EGit1

• Introduction to EGit and installation into Eclipse;• Load local existing project into remote GitHub repository;• Clone remote project into local repository.

1All the instructions are taken from Lars Vogel’s bloghttp://www.vogella.com/tutorials/EclipseGit/article.htmland from Eclipsepedia https://wiki.eclipse.org/EGit/User_Guide.

Riccardo Rigon, Francesco SerafinMarch 20, 2014 2 / 48

Page 3: Using Git Inside Eclipse, Pushing/Cloning from GitHub

Introduction Push new local project on remote Clone remote repo in your local Push modifies of cloned project

Objectives

Some useful applications of EGit1

• Introduction to EGit and installation into Eclipse;• Load local existing project into remote GitHub repository;• Clone remote project into local repository.

1All the instructions are taken from Lars Vogel’s bloghttp://www.vogella.com/tutorials/EclipseGit/article.htmland from Eclipsepedia https://wiki.eclipse.org/EGit/User_Guide.

Riccardo Rigon, Francesco SerafinMarch 20, 2014 2 / 48

Page 4: Using Git Inside Eclipse, Pushing/Cloning from GitHub

Introduction Push new local project on remote Clone remote repo in your local Push modifies of cloned project

Objectives

Some useful applications of EGit1

• Introduction to EGit and installation into Eclipse;• Load local existing project into remote GitHub repository;• Clone remote project into local repository.

1All the instructions are taken from Lars Vogel’s bloghttp://www.vogella.com/tutorials/EclipseGit/article.htmland from Eclipsepedia https://wiki.eclipse.org/EGit/User_Guide.

Riccardo Rigon, Francesco SerafinMarch 20, 2014 2 / 48

Page 5: Using Git Inside Eclipse, Pushing/Cloning from GitHub

Introduction Push new local project on remote Clone remote repo in your local Push modifies of cloned project

Objectives

Some useful applications of EGit1

• Introduction to EGit and installation into Eclipse;• Load local existing project into remote GitHub repository;• Clone remote project into local repository.

1All the instructions are taken from Lars Vogel’s bloghttp://www.vogella.com/tutorials/EclipseGit/article.htmland from Eclipsepedia https://wiki.eclipse.org/EGit/User_Guide.

Riccardo Rigon, Francesco SerafinMarch 20, 2014 2 / 48

Page 6: Using Git Inside Eclipse, Pushing/Cloning from GitHub

Introduction Push new local project on remote Clone remote repo in your local Push modifies of cloned project

Objectives

Some useful applications of EGit1

• Introduction to EGit and installation into Eclipse;• Load local existing project into remote GitHub repository;• Clone remote project into local repository.

For the complete guide visithttp://www.vogella.com/tutorials/EclipseGit/article.htmlhttps://wiki.eclipse.org/EGit/User_Guide

1All the instructions are taken from Lars Vogel’s bloghttp://www.vogella.com/tutorials/EclipseGit/article.htmland from Eclipsepedia https://wiki.eclipse.org/EGit/User_Guide.

Riccardo Rigon, Francesco SerafinMarch 20, 2014 2 / 48

Page 7: Using Git Inside Eclipse, Pushing/Cloning from GitHub

Introduction Push new local project on remote Clone remote repo in your local Push modifies of cloned project

Git and GitHub

What is Git?

In software development, Git is a distributed revision control and source codemanagement system2.

2Git was initially designed and developed by Linus Torvalds for Linux kernel development

Riccardo Rigon, Francesco SerafinMarch 20, 2014 3 / 48

Page 8: Using Git Inside Eclipse, Pushing/Cloning from GitHub

Introduction Push new local project on remote Clone remote repo in your local Push modifies of cloned project

Git and GitHub

What is Git?

In software development, Git is a distributed revision control and source codemanagement system2.

Distributed revision controlIn computer programming, a distributed revision control system (DRCS) ordistributed version control system (DVCS) keeps track of software revisions andallows many developers to work on a given project without requiring that theymaintain a connection to a common network.

2Git was initially designed and developed by Linus Torvalds for Linux kernel development

Riccardo Rigon, Francesco SerafinMarch 20, 2014 3 / 48

Page 9: Using Git Inside Eclipse, Pushing/Cloning from GitHub

Introduction Push new local project on remote Clone remote repo in your local Push modifies of cloned project

Git and GitHub

What is Git?

In software development, Git is a distributed revision control and source codemanagement system2.

Distributed revision controlIn computer programming, a distributed revision control system (DRCS) ordistributed version control system (DVCS) keeps track of software revisions andallows many developers to work on a given project without requiring that theymaintain a connection to a common network.

Every Git working directory is a full-fledged repository with complete historyand full version tracking capabilities, not dependent on network access or acentral server.

2Git was initially designed and developed by Linus Torvalds for Linux kernel development

Riccardo Rigon, Francesco SerafinMarch 20, 2014 3 / 48

Page 10: Using Git Inside Eclipse, Pushing/Cloning from GitHub

Introduction Push new local project on remote Clone remote repo in your local Push modifies of cloned project

Git and GitHub

What is GitHub?

GitHub is a web-based hosting service for software development projects thatuse the Git revision control system. GitHub offers both paid plans for privaterepositories, and free accounts for open source projects.

Riccardo Rigon, Francesco SerafinMarch 20, 2014 4 / 48

Page 11: Using Git Inside Eclipse, Pushing/Cloning from GitHub

Introduction Push new local project on remote Clone remote repo in your local Push modifies of cloned project

Git and GitHub

What is GitHub?

GitHub is a web-based hosting service for software development projects thatuse the Git revision control system. GitHub offers both paid plans for privaterepositories, and free accounts for open source projects.

The site provides social networkingfunctionality such as feeds, followers,wikis and the social network graph todisplay how developers work on theirversions of a repository.

Riccardo Rigon, Francesco SerafinMarch 20, 2014 4 / 48

Page 12: Using Git Inside Eclipse, Pushing/Cloning from GitHub

Introduction Push new local project on remote Clone remote repo in your local Push modifies of cloned project

What is EGit

What is EGit?

EGit is an Eclipse plug-in which allows you to use the distributed versioncontrol system Git directly within the Eclipse IDE.

EGit is based on the JGit library.

Riccardo Rigon, Francesco SerafinMarch 20, 2014 5 / 48

Page 13: Using Git Inside Eclipse, Pushing/Cloning from GitHub

Introduction Push new local project on remote Clone remote repo in your local Push modifies of cloned project

What is EGit

What is EGit?

EGit is an Eclipse plug-in which allows you to use the distributed versioncontrol system Git directly within the Eclipse IDE.

EGit is based on the JGit library.

JGitJGit is a library which implements the Gitfunctionality in Java

Riccardo Rigon, Francesco SerafinMarch 20, 2014 5 / 48

Page 14: Using Git Inside Eclipse, Pushing/Cloning from GitHub

Introduction Push new local project on remote Clone remote repo in your local Push modifies of cloned project

Installation of Git into Eclipse

Installation of EGit

The EGit plug-in can be installed into every Eclipse IDE installation.

Riccardo Rigon, Francesco SerafinMarch 20, 2014 6 / 48

Page 15: Using Git Inside Eclipse, Pushing/Cloning from GitHub

Introduction Push new local project on remote Clone remote repo in your local Push modifies of cloned project

Installation of Git into Eclipse

Installation of EGit

The EGit plug-in can be installed into every Eclipse IDE installation.

Most Eclipse 4.2 and Eclipse 4.3 downloads from Eclipse.org contain EGit intheir default configuration

Riccardo Rigon, Francesco SerafinMarch 20, 2014 6 / 48

Page 16: Using Git Inside Eclipse, Pushing/Cloning from GitHub

Introduction Push new local project on remote Clone remote repo in your local Push modifies of cloned project

Installation of Git into Eclipse

Installation of EGit

The EGit plug-in can be installed into every Eclipse IDE installation.

Most Eclipse 4.2 and Eclipse 4.3 downloads from Eclipse.org contain EGit intheir default configuration

No additional installation is required

Riccardo Rigon, Francesco SerafinMarch 20, 2014 6 / 48

Page 17: Using Git Inside Eclipse, Pushing/Cloning from GitHub

Introduction Push new local project on remote Clone remote repo in your local Push modifies of cloned project

Installation of Git into Eclipse

Installation of EGit

The EGit plug-in can be installed into every Eclipse IDE installation.

Most Eclipse 4.2 and Eclipse 4.3 downloads from Eclipse.org contain EGit intheir default configuration

No additional installation is required

If the EGit plug-in is missing in your Eclipse installation, you can install it viathe Eclipse Marketplace. Start this manager via the Help→EclipseMarketplace menu entry.

Riccardo Rigon, Francesco SerafinMarch 20, 2014 6 / 48

Page 18: Using Git Inside Eclipse, Pushing/Cloning from GitHub

Introduction Push new local project on remote Clone remote repo in your local Push modifies of cloned project

Installation of Git into Eclipse

Installation of EGit

The EGit plug-in can be installed into every Eclipse IDE installation.

Most Eclipse 4.2 and Eclipse 4.3 downloads from Eclipse.org contain EGit intheir default configuration

No additional installation is required

If the EGit plug-in is missing in your Eclipse installation, you can install it viathe Eclipse Marketplace. Start this manager via the Help→EclipseMarketplace menu entry.

Riccardo Rigon, Francesco SerafinMarch 20, 2014 6 / 48

Page 19: Using Git Inside Eclipse, Pushing/Cloning from GitHub

Introduction Push new local project on remote Clone remote repo in your local Push modifies of cloned project

Installation of Git into Eclipse

Eclipse Marketplace

The dialog to install EGit is depicted in the following screenshot.

Riccardo Rigon, Francesco SerafinMarch 20, 2014 7 / 48

Page 20: Using Git Inside Eclipse, Pushing/Cloning from GitHub

Introduction Push new local project on remote Clone remote repo in your local Push modifies of cloned project

Installation of Git into Eclipse

Eclipse Marketplace

The dialog to install EGit is depicted in the following screenshot.

Riccardo Rigon, Francesco SerafinMarch 20, 2014 7 / 48

Page 21: Using Git Inside Eclipse, Pushing/Cloning from GitHub

Introduction Push new local project on remote Clone remote repo in your local Push modifies of cloned project

Setting up Git in Eclipse

Eclipse preferences

Before using EGit you should:• create a folder where store the projects you want to load on GitHub (theGit default repository folder);

• configure your name used in Git;• configure your email address used in Git3;• configure your Git default repository folder.

3Git configuration settings can be configured using the EGit configuration preference pagebut this configuration is not store in the Eclipse preferences store but in git configuration filesin order to ensure that native git sees the same configuration.

Riccardo Rigon, Francesco SerafinMarch 20, 2014 8 / 48

Page 22: Using Git Inside Eclipse, Pushing/Cloning from GitHub

Introduction Push new local project on remote Clone remote repo in your local Push modifies of cloned project

Setting up Git in Eclipse

Eclipse preferences

Before using EGit you should:• create a folder where store the projects you want to load on GitHub (theGit default repository folder);

• configure your name used in Git;• configure your email address used in Git3;• configure your Git default repository folder.

3Git configuration settings can be configured using the EGit configuration preference pagebut this configuration is not store in the Eclipse preferences store but in git configuration filesin order to ensure that native git sees the same configuration.

Riccardo Rigon, Francesco SerafinMarch 20, 2014 8 / 48

Page 23: Using Git Inside Eclipse, Pushing/Cloning from GitHub

Introduction Push new local project on remote Clone remote repo in your local Push modifies of cloned project

Setting up Git in Eclipse

Eclipse preferences

Before using EGit you should:• create a folder where store the projects you want to load on GitHub (theGit default repository folder);

• configure your name used in Git;• configure your email address used in Git3;• configure your Git default repository folder.

3Git configuration settings can be configured using the EGit configuration preference pagebut this configuration is not store in the Eclipse preferences store but in git configuration filesin order to ensure that native git sees the same configuration.

Riccardo Rigon, Francesco SerafinMarch 20, 2014 8 / 48

Page 24: Using Git Inside Eclipse, Pushing/Cloning from GitHub

Introduction Push new local project on remote Clone remote repo in your local Push modifies of cloned project

Setting up Git in Eclipse

Eclipse preferences

Before using EGit you should:• create a folder where store the projects you want to load on GitHub (theGit default repository folder);

• configure your name used in Git;• configure your email address used in Git3;• configure your Git default repository folder.

3Git configuration settings can be configured using the EGit configuration preference pagebut this configuration is not store in the Eclipse preferences store but in git configuration filesin order to ensure that native git sees the same configuration.

Riccardo Rigon, Francesco SerafinMarch 20, 2014 8 / 48

Page 25: Using Git Inside Eclipse, Pushing/Cloning from GitHub

Introduction Push new local project on remote Clone remote repo in your local Push modifies of cloned project

Setting up Git in Eclipse

Eclipse preferences

Before using EGit you should:• create a folder where store the projects you want to load on GitHub (theGit default repository folder);

• configure your name used in Git;• configure your email address used in Git3;• configure your Git default repository folder.

3Git configuration settings can be configured using the EGit configuration preference pagebut this configuration is not store in the Eclipse preferences store but in git configuration filesin order to ensure that native git sees the same configuration.

Riccardo Rigon, Francesco SerafinMarch 20, 2014 8 / 48

Page 26: Using Git Inside Eclipse, Pushing/Cloning from GitHub

Introduction Push new local project on remote Clone remote repo in your local Push modifies of cloned project

Setting up Git in Eclipse

Eclipse preferences

Before using EGit you should:• create a folder where store the projects you want to load on GitHub (theGit default repository folder);

• configure your name used in Git;• configure your email address used in Git3;• configure your Git default repository folder.

The Eclipse Git functionality allows you to configure your default user andemail address for a commit. SelectWindow→Preferences→Team→Git→Configuration to set them up.

3Git configuration settings can be configured using the EGit configuration preference pagebut this configuration is not store in the Eclipse preferences store but in git configuration filesin order to ensure that native git sees the same configuration.

Riccardo Rigon, Francesco SerafinMarch 20, 2014 8 / 48

Page 27: Using Git Inside Eclipse, Pushing/Cloning from GitHub

Introduction Push new local project on remote Clone remote repo in your local Push modifies of cloned project

Setting up Git in Eclipse

Set up name and email used in Git

You can add entries to your Git configuration by pressing the Add Entry buttonon the Git Configuration preference page.

Riccardo Rigon, Francesco SerafinMarch 20, 2014 9 / 48

Page 28: Using Git Inside Eclipse, Pushing/Cloning from GitHub

Introduction Push new local project on remote Clone remote repo in your local Push modifies of cloned project

Setting up Git in Eclipse

Set up name and email used in Git

You can add entries to your Git configuration by pressing the Add Entry buttonon the Git Configuration preference page.

Riccardo Rigon, Francesco SerafinMarch 20, 2014 9 / 48

Page 29: Using Git Inside Eclipse, Pushing/Cloning from GitHub

Introduction Push new local project on remote Clone remote repo in your local Push modifies of cloned project

Setting up Git in Eclipse

Set up name used in Git

To add your user, use the user.name as key and your real name as value.

Riccardo Rigon, Francesco SerafinMarch 20, 2014 10 / 48

Page 30: Using Git Inside Eclipse, Pushing/Cloning from GitHub

Introduction Push new local project on remote Clone remote repo in your local Push modifies of cloned project

Setting up Git in Eclipse

Set up mail used in Git

Repeat the procedure for your email address, using user.email as key as shownbelow.

Riccardo Rigon, Francesco SerafinMarch 20, 2014 11 / 48

Page 31: Using Git Inside Eclipse, Pushing/Cloning from GitHub

Introduction Push new local project on remote Clone remote repo in your local Push modifies of cloned project

Setting up Git in Eclipse

Set up Git default repository folder

You can also enter the default folder for storing Git repositories via theWindow→Preferences→Team→Git and writing the correct path in DefaultRepository Folder entry.

Riccardo Rigon, Francesco SerafinMarch 20, 2014 12 / 48

Page 32: Using Git Inside Eclipse, Pushing/Cloning from GitHub

Introduction Push new local project on remote Clone remote repo in your local Push modifies of cloned project

Setting up Git in Eclipse

Set up Git default repository folder

You can also enter the default folder for storing Git repositories via theWindow→Preferences→Team→Git and writing the correct path in DefaultRepository Folder entry.

Riccardo Rigon, Francesco SerafinMarch 20, 2014 12 / 48

Page 33: Using Git Inside Eclipse, Pushing/Cloning from GitHub

Introduction Push new local project on remote Clone remote repo in your local Push modifies of cloned project

Create the Project

New Java Project

Create a new Java project (we will work with a simple Hello World code).

• Right click in the white space ofthe Package Explorer, after clickon New→Java Project;

• In the Dialog that appeared,remove the tick in Use defaultlocation;

• Click on Browse, in the Dialogthat appeared enter in your Gitdefault repository folder and createa new folder namedJavaForHydrologists.example.Enter in the new folder and clickOK.

• Thus Eclipse automatically setsthe Folder Name like ProjectName. Then click Finish.

Riccardo Rigon, Francesco SerafinMarch 20, 2014 13 / 48

Page 34: Using Git Inside Eclipse, Pushing/Cloning from GitHub

Introduction Push new local project on remote Clone remote repo in your local Push modifies of cloned project

Create the Project

New Java Project

Create a new Java project (we will work with a simple Hello World code).

• Right click in the white space ofthe Package Explorer, after clickon New→Java Project;

• In the Dialog that appeared,remove the tick in Use defaultlocation;

• Click on Browse, in the Dialogthat appeared enter in your Gitdefault repository folder and createa new folder namedJavaForHydrologists.example.Enter in the new folder and clickOK.

• Thus Eclipse automatically setsthe Folder Name like ProjectName. Then click Finish.

Riccardo Rigon, Francesco SerafinMarch 20, 2014 13 / 48

Page 35: Using Git Inside Eclipse, Pushing/Cloning from GitHub

Introduction Push new local project on remote Clone remote repo in your local Push modifies of cloned project

Create the Project

New Java Project

Create a new Java project (we will work with a simple Hello World code).

• Right click in the white space ofthe Package Explorer, after clickon New→Java Project;

• In the Dialog that appeared,remove the tick in Use defaultlocation;

• Click on Browse, in the Dialogthat appeared enter in your Gitdefault repository folder and createa new folder namedJavaForHydrologists.example.Enter in the new folder and clickOK.

• Thus Eclipse automatically setsthe Folder Name like ProjectName. Then click Finish.

Riccardo Rigon, Francesco SerafinMarch 20, 2014 13 / 48

Page 36: Using Git Inside Eclipse, Pushing/Cloning from GitHub

Introduction Push new local project on remote Clone remote repo in your local Push modifies of cloned project

Create the Project

New Java Project

Create a new Java project (we will work with a simple Hello World code).

• Right click in the white space ofthe Package Explorer, after clickon New→Java Project;

• In the Dialog that appeared,remove the tick in Use defaultlocation;

• Click on Browse, in the Dialogthat appeared enter in your Gitdefault repository folder and createa new folder namedJavaForHydrologists.example.Enter in the new folder and clickOK.

• Thus Eclipse automatically setsthe Folder Name like ProjectName. Then click Finish.

Riccardo Rigon, Francesco SerafinMarch 20, 2014 13 / 48

Page 37: Using Git Inside Eclipse, Pushing/Cloning from GitHub

Introduction Push new local project on remote Clone remote repo in your local Push modifies of cloned project

Create the Project

New Java Project

Create a new Java project (we will work with a simple Hello World code).

• Right click in the white space ofthe Package Explorer, after clickon New→Java Project;

• In the Dialog that appeared,remove the tick in Use defaultlocation;

• Click on Browse, in the Dialogthat appeared enter in your Gitdefault repository folder and createa new folder namedJavaForHydrologists.example.Enter in the new folder and clickOK.

• Thus Eclipse automatically setsthe Folder Name like ProjectName. Then click Finish.

Riccardo Rigon, Francesco SerafinMarch 20, 2014 13 / 48

Page 38: Using Git Inside Eclipse, Pushing/Cloning from GitHub

Introduction Push new local project on remote Clone remote repo in your local Push modifies of cloned project

Create the Project

New Java Project

Create a new Java project (we will work with a simple Hello World code).

• Right click in the white space ofthe Package Explorer, after clickon New→Java Project;

• In the Dialog that appeared,remove the tick in Use defaultlocation;

• Click on Browse, in the Dialogthat appeared enter in your Gitdefault repository folder and createa new folder namedJavaForHydrologists.example.Enter in the new folder and clickOK.

• Thus Eclipse automatically setsthe Folder Name like ProjectName. Then click Finish.

Riccardo Rigon, Francesco SerafinMarch 20, 2014 13 / 48

Page 39: Using Git Inside Eclipse, Pushing/Cloning from GitHub

Introduction Push new local project on remote Clone remote repo in your local Push modifies of cloned project

Create the Project

New Java Project

Create a new Java project (we will work with a simple Hello World code).

• Right click in the white space ofthe Package Explorer, after clickon New→Java Project;

• In the Dialog that appeared,remove the tick in Use defaultlocation;

• Click on Browse, in the Dialogthat appeared enter in your Gitdefault repository folder and createa new folder namedJavaForHydrologists.example.Enter in the new folder and clickOK.

• Thus Eclipse automatically setsthe Folder Name like ProjectName. Then click Finish.

Riccardo Rigon, Francesco SerafinMarch 20, 2014 13 / 48

Page 40: Using Git Inside Eclipse, Pushing/Cloning from GitHub

Introduction Push new local project on remote Clone remote repo in your local Push modifies of cloned project

Create the Project

Hello World!

Now write a simple Hello World code in the newly created project.

Riccardo Rigon, Francesco SerafinMarch 20, 2014 14 / 48

Page 41: Using Git Inside Eclipse, Pushing/Cloning from GitHub

Introduction Push new local project on remote Clone remote repo in your local Push modifies of cloned project

Create the Project

Hello World!

Now write a simple Hello World code in the newly created project.

You must:• Create a new package;• Create a new class;• Write the code.

Riccardo Rigon, Francesco SerafinMarch 20, 2014 14 / 48

Page 42: Using Git Inside Eclipse, Pushing/Cloning from GitHub

Introduction Push new local project on remote Clone remote repo in your local Push modifies of cloned project

Create the Project

Hello World!

Now write a simple Hello World code in the newly created project.

You must:• Create a new package;• Create a new class;• Write the code.

Riccardo Rigon, Francesco SerafinMarch 20, 2014 14 / 48

Page 43: Using Git Inside Eclipse, Pushing/Cloning from GitHub

Introduction Push new local project on remote Clone remote repo in your local Push modifies of cloned project

Create the Project

Hello World!

Now write a simple Hello World code in the newly created project.

You must:• Create a new package;• Create a new class;• Write the code.

Riccardo Rigon, Francesco SerafinMarch 20, 2014 14 / 48

Page 44: Using Git Inside Eclipse, Pushing/Cloning from GitHub

Introduction Push new local project on remote Clone remote repo in your local Push modifies of cloned project

Create the Project

Hello World!

Now write a simple Hello World code in the newly created project.

You must:• Create a new package;• Create a new class;• Write the code.

Riccardo Rigon, Francesco SerafinMarch 20, 2014 14 / 48

Page 45: Using Git Inside Eclipse, Pushing/Cloning from GitHub

Introduction Push new local project on remote Clone remote repo in your local Push modifies of cloned project

Create the Project

Hello World!

Now write a simple Hello World code in the newly created project.

You must:• Create a new package;• Create a new class;• Write the code.

Once you have wrote the code, we are going to create a local Git Repository.

Riccardo Rigon, Francesco SerafinMarch 20, 2014 14 / 48

Page 46: Using Git Inside Eclipse, Pushing/Cloning from GitHub

Introduction Push new local project on remote Clone remote repo in your local Push modifies of cloned project

Create local Git Repository

Git Repositories view

First we need to view the Git Repositories present in our Git default repository.

• Click onWindow→Show View→Other ;

• In the Show view Dialog, expandGit and click on Git Repositories.Then click OK;

• Now you can see the GitRepositories tab in your EclipseIDE.

Riccardo Rigon, Francesco SerafinMarch 20, 2014 15 / 48

Page 47: Using Git Inside Eclipse, Pushing/Cloning from GitHub

Introduction Push new local project on remote Clone remote repo in your local Push modifies of cloned project

Create local Git Repository

Git Repositories view

First we need to view the Git Repositories present in our Git default repository.

• Click onWindow→Show View→Other ;

• In the Show view Dialog, expandGit and click on Git Repositories.Then click OK;

• Now you can see the GitRepositories tab in your EclipseIDE.

Riccardo Rigon, Francesco SerafinMarch 20, 2014 15 / 48

Page 48: Using Git Inside Eclipse, Pushing/Cloning from GitHub

Introduction Push new local project on remote Clone remote repo in your local Push modifies of cloned project

Create local Git Repository

Git Repositories view

First we need to view the Git Repositories present in our Git default repository.

• Click onWindow→Show View→Other ;

• In the Show view Dialog, expandGit and click on Git Repositories.Then click OK;

• Now you can see the GitRepositories tab in your EclipseIDE.

Riccardo Rigon, Francesco SerafinMarch 20, 2014 15 / 48

Page 49: Using Git Inside Eclipse, Pushing/Cloning from GitHub

Introduction Push new local project on remote Clone remote repo in your local Push modifies of cloned project

Create local Git Repository

Git Repositories view

First we need to view the Git Repositories present in our Git default repository.

• Click onWindow→Show View→Other ;

• In the Show view Dialog, expandGit and click on Git Repositories.Then click OK;

• Now you can see the GitRepositories tab in your EclipseIDE.

Riccardo Rigon, Francesco SerafinMarch 20, 2014 15 / 48

Page 50: Using Git Inside Eclipse, Pushing/Cloning from GitHub

Introduction Push new local project on remote Clone remote repo in your local Push modifies of cloned project

Create local Git Repository

Share the Java Project

To create a new Git local Repository, we have to share the existing project.

• Right click on theJavaForydrologists.example projectand then click to Team→ShareProject;

• Select the repository type Git andclick Next;

• To configure the Git repositoryselect Use or create repository inparent folder of project;

• In the next Dialog select theproject and click to CreateRepository, after click Finish;

Riccardo Rigon, Francesco SerafinMarch 20, 2014 16 / 48

Page 51: Using Git Inside Eclipse, Pushing/Cloning from GitHub

Introduction Push new local project on remote Clone remote repo in your local Push modifies of cloned project

Create local Git Repository

Share the Java Project

To create a new Git local Repository, we have to share the existing project.

• Right click on theJavaForydrologists.example projectand then click to Team→ShareProject;

• Select the repository type Git andclick Next;

• To configure the Git repositoryselect Use or create repository inparent folder of project;

• In the next Dialog select theproject and click to CreateRepository, after click Finish;

Riccardo Rigon, Francesco SerafinMarch 20, 2014 16 / 48

Page 52: Using Git Inside Eclipse, Pushing/Cloning from GitHub

Introduction Push new local project on remote Clone remote repo in your local Push modifies of cloned project

Create local Git Repository

Share the Java Project

To create a new Git local Repository, we have to share the existing project.

• Right click on theJavaForydrologists.example projectand then click to Team→ShareProject;

• Select the repository type Git andclick Next;

• To configure the Git repositoryselect Use or create repository inparent folder of project;

• In the next Dialog select theproject and click to CreateRepository, after click Finish;

Riccardo Rigon, Francesco SerafinMarch 20, 2014 16 / 48

Page 53: Using Git Inside Eclipse, Pushing/Cloning from GitHub

Introduction Push new local project on remote Clone remote repo in your local Push modifies of cloned project

Create local Git Repository

Share the Java Project

To create a new Git local Repository, we have to share the existing project.

• Right click on theJavaForydrologists.example projectand then click to Team→ShareProject;

• Select the repository type Git andclick Next;

• To configure the Git repositoryselect Use or create repository inparent folder of project;

• In the next Dialog select theproject and click to CreateRepository, after click Finish;

Riccardo Rigon, Francesco SerafinMarch 20, 2014 16 / 48

Page 54: Using Git Inside Eclipse, Pushing/Cloning from GitHub

Introduction Push new local project on remote Clone remote repo in your local Push modifies of cloned project

Create local Git Repository

Share the Java Project

To create a new Git local Repository, we have to share the existing project.

• Right click on theJavaForydrologists.example projectand then click to Team→ShareProject;

• Select the repository type Git andclick Next;

• To configure the Git repositoryselect Use or create repository inparent folder of project;

• In the next Dialog select theproject and click to CreateRepository, after click Finish;

Riccardo Rigon, Francesco SerafinMarch 20, 2014 16 / 48

Page 55: Using Git Inside Eclipse, Pushing/Cloning from GitHub

Introduction Push new local project on remote Clone remote repo in your local Push modifies of cloned project

Create local Git Repository

But the decorator text “[NO-HEAD]” behind the project shows that this projectis not tracked in a repository and the question mark decorators show that the.classpath, .project, the .settings files and the src content are not yet under versioncontrol.

Riccardo Rigon, Francesco SerafinMarch 20, 2014 17 / 48

Page 56: Using Git Inside Eclipse, Pushing/Cloning from GitHub

Introduction Push new local project on remote Clone remote repo in your local Push modifies of cloned project

Create a remote repository on GitHub

Create a remote repository on GitHub

Go to www.github.com and log in with your credentials. In your home clicklike below.

Riccardo Rigon, Francesco SerafinMarch 20, 2014 18 / 48

Page 57: Using Git Inside Eclipse, Pushing/Cloning from GitHub

Introduction Push new local project on remote Clone remote repo in your local Push modifies of cloned project

Create a remote repository on GitHub

Create a remote repository on GitHub

Go to www.github.com and log in with your credentials. In your home clicklike below.

Riccardo Rigon, Francesco SerafinMarch 20, 2014 18 / 48

Page 58: Using Git Inside Eclipse, Pushing/Cloning from GitHub

Introduction Push new local project on remote Clone remote repo in your local Push modifies of cloned project

Create a remote repository on GitHub

Create a remote repository on GitHub

Go to www.github.com and log in with your credentials. In your home clicklike below.

Riccardo Rigon, Francesco SerafinMarch 20, 2014 18 / 48

Page 59: Using Git Inside Eclipse, Pushing/Cloning from GitHub

Introduction Push new local project on remote Clone remote repo in your local Push modifies of cloned project

Create a remote repository on GitHub

Repository name: JavaFor Hydrologists.example

Riccardo Rigon, Francesco SerafinMarch 20, 2014 19 / 48

Page 60: Using Git Inside Eclipse, Pushing/Cloning from GitHub

Introduction Push new local project on remote Clone remote repo in your local Push modifies of cloned project

Create a remote repository on GitHub

Repository name: JavaFor Hydrologists.example

Riccardo Rigon, Francesco SerafinMarch 20, 2014 19 / 48

Page 61: Using Git Inside Eclipse, Pushing/Cloning from GitHub

Introduction Push new local project on remote Clone remote repo in your local Push modifies of cloned project

Create a remote repository on GitHub

Description of the repository: First GitHub repository to use with EGit

Riccardo Rigon, Francesco SerafinMarch 20, 2014 20 / 48

Page 62: Using Git Inside Eclipse, Pushing/Cloning from GitHub

Introduction Push new local project on remote Clone remote repo in your local Push modifies of cloned project

Create a remote repository on GitHub

Description of the repository: First GitHub repository to use with EGit

Riccardo Rigon, Francesco SerafinMarch 20, 2014 20 / 48

Page 63: Using Git Inside Eclipse, Pushing/Cloning from GitHub

Introduction Push new local project on remote Clone remote repo in your local Push modifies of cloned project

Create a remote repository on GitHub

Click to Create repository

Riccardo Rigon, Francesco SerafinMarch 20, 2014 21 / 48

Page 64: Using Git Inside Eclipse, Pushing/Cloning from GitHub

Introduction Push new local project on remote Clone remote repo in your local Push modifies of cloned project

Create a remote repository on GitHub

Click to Create repository

Riccardo Rigon, Francesco SerafinMarch 20, 2014 21 / 48

Page 65: Using Git Inside Eclipse, Pushing/Cloning from GitHub

Introduction Push new local project on remote Clone remote repo in your local Push modifies of cloned project

Create a remote repository on GitHub

After creation of your new repository, GitHub displays the information aboutwhat you have to do if you want to connetc to this repository via the commandline.

Riccardo Rigon, Francesco SerafinMarch 20, 2014 22 / 48

Page 66: Using Git Inside Eclipse, Pushing/Cloning from GitHub

Introduction Push new local project on remote Clone remote repo in your local Push modifies of cloned project

Create a remote repository on GitHub

After creation of your new repository, GitHub displays the information aboutwhat you have to do if you want to connetc to this repository via the commandline.

Riccardo Rigon, Francesco SerafinMarch 20, 2014 22 / 48

Page 67: Using Git Inside Eclipse, Pushing/Cloning from GitHub

Introduction Push new local project on remote Clone remote repo in your local Push modifies of cloned project

Create a remote repository on GitHub

After creation of your new repository, GitHub displays the information aboutwhat you have to do if you want to connetc to this repository via the commandline.

As we are going to use EGit you can ignore this information, but don’t closethe window because we need the SSH or HTTP link.

Riccardo Rigon, Francesco SerafinMarch 20, 2014 22 / 48

Page 68: Using Git Inside Eclipse, Pushing/Cloning from GitHub

Introduction Push new local project on remote Clone remote repo in your local Push modifies of cloned project

Set Remote in local repository

Create Remote

Now we have the link indispensable to establish the connection between localand remote repository. Thus, in Eclipse in the Git Repositories tab, expand theJavaForHydrologists.example and right click on Remote and then CreateRemote.

Riccardo Rigon, Francesco SerafinMarch 20, 2014 23 / 48

Page 69: Using Git Inside Eclipse, Pushing/Cloning from GitHub

Introduction Push new local project on remote Clone remote repo in your local Push modifies of cloned project

Set Remote in local repository

Create Remote

• In the open Dialog the Remotename must be origin, then clickOK;

• To Configure Push, in the nextDialog click on Change;

• From your Git Remote Repository,copy the https link and paste it inthe URI space. Eclipseautomatically will fill the otherfileds

• After you must only write yourGitHub credentials and the click toFinish.

Riccardo Rigon, Francesco SerafinMarch 20, 2014 24 / 48

Page 70: Using Git Inside Eclipse, Pushing/Cloning from GitHub

Introduction Push new local project on remote Clone remote repo in your local Push modifies of cloned project

Set Remote in local repository

Create Remote

• In the open Dialog the Remotename must be origin, then clickOK;

• To Configure Push, in the nextDialog click on Change;

• From your Git Remote Repository,copy the https link and paste it inthe URI space. Eclipseautomatically will fill the otherfileds

• After you must only write yourGitHub credentials and the click toFinish.

Riccardo Rigon, Francesco SerafinMarch 20, 2014 24 / 48

Page 71: Using Git Inside Eclipse, Pushing/Cloning from GitHub

Introduction Push new local project on remote Clone remote repo in your local Push modifies of cloned project

Set Remote in local repository

Create Remote

• In the open Dialog the Remotename must be origin, then clickOK;

• To Configure Push, in the nextDialog click on Change;

• From your Git Remote Repository,copy the https link and paste it inthe URI space. Eclipseautomatically will fill the otherfileds

• After you must only write yourGitHub credentials and the click toFinish.

Riccardo Rigon, Francesco SerafinMarch 20, 2014 24 / 48

Page 72: Using Git Inside Eclipse, Pushing/Cloning from GitHub

Introduction Push new local project on remote Clone remote repo in your local Push modifies of cloned project

Set Remote in local repository

Create Remote

• In the open Dialog the Remotename must be origin, then clickOK;

• To Configure Push, in the nextDialog click on Change;

• From your Git Remote Repository,copy the https link and paste it inthe URI space. Eclipseautomatically will fill the otherfileds

• After you must only write yourGitHub credentials and the click toFinish.

Riccardo Rigon, Francesco SerafinMarch 20, 2014 24 / 48

Page 73: Using Git Inside Eclipse, Pushing/Cloning from GitHub

Introduction Push new local project on remote Clone remote repo in your local Push modifies of cloned project

Set Remote in local repository

Create Remote

• In the open Dialog the Remotename must be origin, then clickOK;

• To Configure Push, in the nextDialog click on Change;

• From your Git Remote Repository,copy the https link and paste it inthe URI space. Eclipseautomatically will fill the otherfileds

• After you must only write yourGitHub credentials and the click toFinish.

Riccardo Rigon, Francesco SerafinMarch 20, 2014 24 / 48

Page 74: Using Git Inside Eclipse, Pushing/Cloning from GitHub

Introduction Push new local project on remote Clone remote repo in your local Push modifies of cloned project

Basic operations in EGit

Basic operations

So we can prepare our local repository to push it to remote repository. Themost important operations are described below. Right click on the project inthe Package Explorer at every step:

• Team→Add to indexto add the selected resource(s) to the

index of Git

• Team→Committo open the commit dialog for

committing to your Git repository

Then click Commit• Team→Push branch

only for the first time, beacuse you mustcreate the first master branch

• In this Dialog there is nothing todo, click Next

• Insert your credentials of GitHub

• In this Dialog click Finish• After push, click OK

Riccardo Rigon, Francesco SerafinMarch 20, 2014 25 / 48

Page 75: Using Git Inside Eclipse, Pushing/Cloning from GitHub

Introduction Push new local project on remote Clone remote repo in your local Push modifies of cloned project

Basic operations in EGit

Basic operations

So we can prepare our local repository to push it to remote repository. Themost important operations are described below. Right click on the project inthe Package Explorer at every step:

• Team→Add to indexto add the selected resource(s) to the

index of Git

• Team→Committo open the commit dialog for

committing to your Git repository

Then click Commit• Team→Push branch

only for the first time, beacuse you mustcreate the first master branch

• In this Dialog there is nothing todo, click Next

• Insert your credentials of GitHub

• In this Dialog click Finish• After push, click OK

Riccardo Rigon, Francesco SerafinMarch 20, 2014 25 / 48

Page 76: Using Git Inside Eclipse, Pushing/Cloning from GitHub

Introduction Push new local project on remote Clone remote repo in your local Push modifies of cloned project

Basic operations in EGit

Basic operations

So we can prepare our local repository to push it to remote repository. Themost important operations are described below. Right click on the project inthe Package Explorer at every step:

• Team→Add to indexto add the selected resource(s) to the

index of Git

• Team→Committo open the commit dialog for

committing to your Git repository

Then click Commit• Team→Push branch

only for the first time, beacuse you mustcreate the first master branch

• In this Dialog there is nothing todo, click Next

• Insert your credentials of GitHub

• In this Dialog click Finish• After push, click OK

Riccardo Rigon, Francesco SerafinMarch 20, 2014 25 / 48

Page 77: Using Git Inside Eclipse, Pushing/Cloning from GitHub

Introduction Push new local project on remote Clone remote repo in your local Push modifies of cloned project

Basic operations in EGit

Basic operations

So we can prepare our local repository to push it to remote repository. Themost important operations are described below. Right click on the project inthe Package Explorer at every step:

• Team→Add to indexto add the selected resource(s) to the

index of Git

• Team→Committo open the commit dialog for

committing to your Git repository

Then click Commit• Team→Push branch

only for the first time, beacuse you mustcreate the first master branch

• In this Dialog there is nothing todo, click Next

• Insert your credentials of GitHub

• In this Dialog click Finish• After push, click OK

Riccardo Rigon, Francesco SerafinMarch 20, 2014 25 / 48

Page 78: Using Git Inside Eclipse, Pushing/Cloning from GitHub

Introduction Push new local project on remote Clone remote repo in your local Push modifies of cloned project

Basic operations in EGit

Basic operations

So we can prepare our local repository to push it to remote repository. Themost important operations are described below. Right click on the project inthe Package Explorer at every step:

• Team→Add to indexto add the selected resource(s) to the

index of Git

• Team→Committo open the commit dialog for

committing to your Git repository

Then click Commit• Team→Push branch

only for the first time, beacuse you mustcreate the first master branch

• In this Dialog there is nothing todo, click Next

• Insert your credentials of GitHub

• In this Dialog click Finish• After push, click OK

Riccardo Rigon, Francesco SerafinMarch 20, 2014 25 / 48

Page 79: Using Git Inside Eclipse, Pushing/Cloning from GitHub

Introduction Push new local project on remote Clone remote repo in your local Push modifies of cloned project

Basic operations in EGit

Basic operations

So we can prepare our local repository to push it to remote repository. Themost important operations are described below. Right click on the project inthe Package Explorer at every step:

• Team→Add to indexto add the selected resource(s) to the

index of Git

• Team→Committo open the commit dialog for

committing to your Git repository

Then click Commit• Team→Push branch

only for the first time, beacuse you mustcreate the first master branch

• In this Dialog there is nothing todo, click Next

• Insert your credentials of GitHub

• In this Dialog click Finish• After push, click OK

Riccardo Rigon, Francesco SerafinMarch 20, 2014 25 / 48

Page 80: Using Git Inside Eclipse, Pushing/Cloning from GitHub

Introduction Push new local project on remote Clone remote repo in your local Push modifies of cloned project

Basic operations in EGit

Basic operations

So we can prepare our local repository to push it to remote repository. Themost important operations are described below. Right click on the project inthe Package Explorer at every step:

• Team→Add to indexto add the selected resource(s) to the

index of Git

• Team→Committo open the commit dialog for

committing to your Git repository

Then click Commit• Team→Push branch

only for the first time, beacuse you mustcreate the first master branch

• In this Dialog there is nothing todo, click Next

• Insert your credentials of GitHub

• In this Dialog click Finish• After push, click OK

Riccardo Rigon, Francesco SerafinMarch 20, 2014 25 / 48

Page 81: Using Git Inside Eclipse, Pushing/Cloning from GitHub

Introduction Push new local project on remote Clone remote repo in your local Push modifies of cloned project

Basic operations in EGit

Basic operations

So we can prepare our local repository to push it to remote repository. Themost important operations are described below. Right click on the project inthe Package Explorer at every step:

• Team→Add to indexto add the selected resource(s) to the

index of Git

• Team→Committo open the commit dialog for

committing to your Git repository

Then click Commit• Team→Push branch

only for the first time, beacuse you mustcreate the first master branch

• In this Dialog there is nothing todo, click Next

• Insert your credentials of GitHub

• In this Dialog click Finish• After push, click OK

Riccardo Rigon, Francesco SerafinMarch 20, 2014 25 / 48

Page 82: Using Git Inside Eclipse, Pushing/Cloning from GitHub

Introduction Push new local project on remote Clone remote repo in your local Push modifies of cloned project

Basic operations in EGit

Basic operations

So we can prepare our local repository to push it to remote repository. Themost important operations are described below. Right click on the project inthe Package Explorer at every step:

• Team→Add to indexto add the selected resource(s) to the

index of Git

• Team→Committo open the commit dialog for

committing to your Git repository

Then click Commit• Team→Push branch

only for the first time, beacuse you mustcreate the first master branch

• In this Dialog there is nothing todo, click Next

• Insert your credentials of GitHub

• In this Dialog click Finish• After push, click OK

Riccardo Rigon, Francesco SerafinMarch 20, 2014 25 / 48

Page 83: Using Git Inside Eclipse, Pushing/Cloning from GitHub

Introduction Push new local project on remote Clone remote repo in your local Push modifies of cloned project

Basic operations in EGit

Basic operations

So we can prepare our local repository to push it to remote repository. Themost important operations are described below. Right click on the project inthe Package Explorer at every step:

• Team→Add to indexto add the selected resource(s) to the

index of Git

• Team→Committo open the commit dialog for

committing to your Git repository

Then click Commit• Team→Push branch

only for the first time, beacuse you mustcreate the first master branch

• In this Dialog there is nothing todo, click Next

• Insert your credentials of GitHub

• In this Dialog click Finish• After push, click OK

Riccardo Rigon, Francesco SerafinMarch 20, 2014 25 / 48

Page 84: Using Git Inside Eclipse, Pushing/Cloning from GitHub

Introduction Push new local project on remote Clone remote repo in your local Push modifies of cloned project

Basic operations in EGit

Summary of the main steps

Our local repository is been now copied on remote repository.

But once you have create the first master branch, to push your modify youneed follow this basic sequence:

• Team→Add to index• Team→Commit• Team→Push to upstream

Riccardo Rigon, Francesco SerafinMarch 20, 2014 26 / 48

Page 85: Using Git Inside Eclipse, Pushing/Cloning from GitHub

Introduction Push new local project on remote Clone remote repo in your local Push modifies of cloned project

Basic operations in EGit

Summary of the main steps

Our local repository is been now copied on remote repository.

But once you have create the first master branch, to push your modify youneed follow this basic sequence:

• Team→Add to index• Team→Commit• Team→Push to upstream

Riccardo Rigon, Francesco SerafinMarch 20, 2014 26 / 48

Page 86: Using Git Inside Eclipse, Pushing/Cloning from GitHub

Introduction Push new local project on remote Clone remote repo in your local Push modifies of cloned project

Basic operations in EGit

Summary of the main steps

Our local repository is been now copied on remote repository.

But once you have create the first master branch, to push your modify youneed follow this basic sequence:

• Team→Add to index• Team→Commit• Team→Push to upstream

Riccardo Rigon, Francesco SerafinMarch 20, 2014 26 / 48

Page 87: Using Git Inside Eclipse, Pushing/Cloning from GitHub

Introduction Push new local project on remote Clone remote repo in your local Push modifies of cloned project

Basic operations in EGit

Summary of the main steps

Our local repository is been now copied on remote repository.

But once you have create the first master branch, to push your modify youneed follow this basic sequence:

• Team→Add to index• Team→Commit• Team→Push to upstream

Riccardo Rigon, Francesco SerafinMarch 20, 2014 26 / 48

Page 88: Using Git Inside Eclipse, Pushing/Cloning from GitHub

Introduction Push new local project on remote Clone remote repo in your local Push modifies of cloned project

Basic operations in EGit

Problems with basic operations

• After clicking Commit;• If you cannot Push to Upstream;• You can fix this problem in theway shown before.

Riccardo Rigon, Francesco SerafinMarch 20, 2014 27 / 48

Page 89: Using Git Inside Eclipse, Pushing/Cloning from GitHub

Introduction Push new local project on remote Clone remote repo in your local Push modifies of cloned project

Basic operations in EGit

Problems with basic operations

• After clicking Commit;• If you cannot Push to Upstream;• You can fix this problem in theway shown before.

Riccardo Rigon, Francesco SerafinMarch 20, 2014 27 / 48

Page 90: Using Git Inside Eclipse, Pushing/Cloning from GitHub

Introduction Push new local project on remote Clone remote repo in your local Push modifies of cloned project

Basic operations in EGit

Problems with basic operations

• After clicking Commit;• If you cannot Push to Upstream;• You can fix this problem in theway shown before.

Riccardo Rigon, Francesco SerafinMarch 20, 2014 27 / 48

Page 91: Using Git Inside Eclipse, Pushing/Cloning from GitHub

Introduction Push new local project on remote Clone remote repo in your local Push modifies of cloned project

Basic operations in EGit

Problems with basic operations

• After clicking Commit;• If you cannot Push to Upstream;• You can fix this problem in theway shown before.

Riccardo Rigon, Francesco SerafinMarch 20, 2014 27 / 48

Page 92: Using Git Inside Eclipse, Pushing/Cloning from GitHub

Introduction Push new local project on remote Clone remote repo in your local Push modifies of cloned project

Basic operations in EGit

Push. . .with more settings

Right click on the project that you want to push and Team→Remote→Push

Riccardo Rigon, Francesco SerafinMarch 20, 2014 28 / 48

Page 93: Using Git Inside Eclipse, Pushing/Cloning from GitHub

Introduction Push new local project on remote Clone remote repo in your local Push modifies of cloned project

Basic operations in EGit

Push. . .with more settings

Select Custom URI and paste in the URI tab the ssh link to your repository.

The ssh form is:

[email protected]:username/project.git

In my case

[email protected]:francescoS/JavaForHydrologists.example.git

Select the ssh protocol andEclipse will fill all tabsautomatically. After click Next

Riccardo Rigon, Francesco SerafinMarch 20, 2014 29 / 48

Page 94: Using Git Inside Eclipse, Pushing/Cloning from GitHub

Introduction Push new local project on remote Clone remote repo in your local Push modifies of cloned project

Basic operations in EGit

Push. . .with more settings

In the window Push to: origin click on drop-down menu of the Source ref andselect master [branch] or the branch you want

Riccardo Rigon, Francesco SerafinMarch 20, 2014 30 / 48

Page 95: Using Git Inside Eclipse, Pushing/Cloning from GitHub

Introduction Push new local project on remote Clone remote repo in your local Push modifies of cloned project

Basic operations in EGit

Push. . .with more settings

Click to Add Spec on the right and Next.

Riccardo Rigon, Francesco SerafinMarch 20, 2014 31 / 48

Page 96: Using Git Inside Eclipse, Pushing/Cloning from GitHub

Introduction Push new local project on remote Clone remote repo in your local Push modifies of cloned project

Basic operations in EGit

Push. . .with more settings

Click to Add Spec on the right and Next.

Riccardo Rigon, Francesco SerafinMarch 20, 2014 31 / 48

Page 97: Using Git Inside Eclipse, Pushing/Cloning from GitHub

Introduction Push new local project on remote Clone remote repo in your local Push modifies of cloned project

Basic operations in EGit

Push. . .with more settings

Click to Add Spec on the right and Next.In the other windows you can see a small summary of the push operation, thenclick Finish.

Riccardo Rigon, Francesco SerafinMarch 20, 2014 31 / 48

Page 98: Using Git Inside Eclipse, Pushing/Cloning from GitHub

Introduction Push new local project on remote Clone remote repo in your local Push modifies of cloned project

Basic operations in EGit

Push...with more settings

After Push operations, the appeared Dialog shows the Push Results.

Riccardo Rigon, Francesco SerafinMarch 20, 2014 32 / 48

Page 99: Using Git Inside Eclipse, Pushing/Cloning from GitHub

Introduction Push new local project on remote Clone remote repo in your local Push modifies of cloned project

Clone project

Introduction

If we are arrived here, I suppose you have your Git Repositories view in theEclipse IDE, otherwise return to 15.

Using the Git Clone Wizard you may clone remote repositories using differenttransport protocols. The wizard can be started by clicking on the botton Clonea Git Repository and add the clone to this view

Riccardo Rigon, Francesco SerafinMarch 20, 2014 33 / 48

Page 100: Using Git Inside Eclipse, Pushing/Cloning from GitHub

Introduction Push new local project on remote Clone remote repo in your local Push modifies of cloned project

Clone project

Repository Selection

Copy the URL from GitHub page of the searched project (in this casehttps://github.com/francescoS/JavaForHydrologists.firstClone) andpaste it in the URI space of the Clone Git Repository Dialog.

The other fields (Host and Repository path) are filled automatically by Eclipse.Riccardo Rigon, Francesco SerafinMarch 20, 2014 34 / 48

Page 101: Using Git Inside Eclipse, Pushing/Cloning from GitHub

Introduction Push new local project on remote Clone remote repo in your local Push modifies of cloned project

Clone project

Repository Selection

Copy the URL from GitHub page of the searched project (in this casehttps://github.com/francescoS/JavaForHydrologists.firstClone) andpaste it in the URI space of the Clone Git Repository Dialog.

The other fields (Host and Repository path) are filled automatically by Eclipse.Riccardo Rigon, Francesco SerafinMarch 20, 2014 34 / 48

Page 102: Using Git Inside Eclipse, Pushing/Cloning from GitHub

Introduction Push new local project on remote Clone remote repo in your local Push modifies of cloned project

Clone project

Repository Selection

You must fill the fields User and Password with your credentials of GitHub.

Riccardo Rigon, Francesco SerafinMarch 20, 2014 35 / 48

Page 103: Using Git Inside Eclipse, Pushing/Cloning from GitHub

Introduction Push new local project on remote Clone remote repo in your local Push modifies of cloned project

Clone project

Repository Selection

You must fill the fields User and Password with your credentials of GitHub.

Riccardo Rigon, Francesco SerafinMarch 20, 2014 35 / 48

Page 104: Using Git Inside Eclipse, Pushing/Cloning from GitHub

Introduction Push new local project on remote Clone remote repo in your local Push modifies of cloned project

Clone project

Branch Selection

Click Next, in the Open Dialog choose wich branches shall be cloned from theremote repository (in this case there is only one branch).

If you are not sure which branches youneed, simply hit Select All. You canfilter the branches by their name bytyping using the text control above thelist.

Riccardo Rigon, Francesco SerafinMarch 20, 2014 36 / 48

Page 105: Using Git Inside Eclipse, Pushing/Cloning from GitHub

Introduction Push new local project on remote Clone remote repo in your local Push modifies of cloned project

Clone project

Local Destination

Click Next, in the Open Dialog select the Directory where store the repositoryon the local file system and define some initial settings. .

Riccardo Rigon, Francesco SerafinMarch 20, 2014 37 / 48

Page 106: Using Git Inside Eclipse, Pushing/Cloning from GitHub

Introduction Push new local project on remote Clone remote repo in your local Push modifies of cloned project

Clone project

Local Destination

Click Next, in the Open Dialog select the Directory where store the repositoryon the local file system and define some initial settings. .

Riccardo Rigon, Francesco SerafinMarch 20, 2014 37 / 48

Page 107: Using Git Inside Eclipse, Pushing/Cloning from GitHub

Introduction Push new local project on remote Clone remote repo in your local Push modifies of cloned project

Clone project

Local Destination

Click Next, in the Open Dialog select the Directory where store the repositoryon the local file system and define some initial settings. Click Finish.

Riccardo Rigon, Francesco SerafinMarch 20, 2014 37 / 48

Page 108: Using Git Inside Eclipse, Pushing/Cloning from GitHub

Introduction Push new local project on remote Clone remote repo in your local Push modifies of cloned project

Import the project in the Package Explorer

Import the project in the Package Explorer

Now, to modify the project that you cloned before, you have to import it in yourPackage Explorer. Thus, right click on the view Package Explorer and Import.

Riccardo Rigon, Francesco SerafinMarch 20, 2014 38 / 48

Page 109: Using Git Inside Eclipse, Pushing/Cloning from GitHub

Introduction Push new local project on remote Clone remote repo in your local Push modifies of cloned project

Import the project in the Package Explorer

Import the project in the Package Explorer

Select Git→Project from Git

Riccardo Rigon, Francesco SerafinMarch 20, 2014 39 / 48

Page 110: Using Git Inside Eclipse, Pushing/Cloning from GitHub

Introduction Push new local project on remote Clone remote repo in your local Push modifies of cloned project

Import the project in the Package Explorer

Import the project in the Package Explorer

Select Git→Project from Git

Riccardo Rigon, Francesco SerafinMarch 20, 2014 39 / 48

Page 111: Using Git Inside Eclipse, Pushing/Cloning from GitHub

Introduction Push new local project on remote Clone remote repo in your local Push modifies of cloned project

Import the project in the Package Explorer

Import the project in the Package Explorer

Select Git→Project from Git and click Next.

Riccardo Rigon, Francesco SerafinMarch 20, 2014 39 / 48

Page 112: Using Git Inside Eclipse, Pushing/Cloning from GitHub

Introduction Push new local project on remote Clone remote repo in your local Push modifies of cloned project

Import the project in the Package Explorer

Import the project in the Package Explorer

Select Existing local repository and click Next.

Riccardo Rigon, Francesco SerafinMarch 20, 2014 40 / 48

Page 113: Using Git Inside Eclipse, Pushing/Cloning from GitHub

Introduction Push new local project on remote Clone remote repo in your local Push modifies of cloned project

Import the project in the Package Explorer

Select the repository JavaForHydrologists.firstClone and click Next.

Riccardo Rigon, Francesco SerafinMarch 20, 2014 41 / 48

Page 114: Using Git Inside Eclipse, Pushing/Cloning from GitHub

Introduction Push new local project on remote Clone remote repo in your local Push modifies of cloned project

Import the project in the Package Explorer

Select Import existing projects and click Next.

Riccardo Rigon, Francesco SerafinMarch 20, 2014 42 / 48

Page 115: Using Git Inside Eclipse, Pushing/Cloning from GitHub

Introduction Push new local project on remote Clone remote repo in your local Push modifies of cloned project

Import the project in the Package Explorer

This is the last Dialog, that summarizes the projects that you are importing.Then click Finish.

Now the project is visible in the Package Explorer and you can modify it.

Riccardo Rigon, Francesco SerafinMarch 20, 2014 43 / 48

Page 116: Using Git Inside Eclipse, Pushing/Cloning from GitHub

Introduction Push new local project on remote Clone remote repo in your local Push modifies of cloned project

How to view Git History

Git History

But first to modify a cloned repository, it’s important to examine the history ofthe entire project. So we are going to open a new tab in our Eclipse IDE:History.

• Click toWindow→Show View→Other ;

• Search and expand Team;• Then select History and click OK.

Riccardo Rigon, Francesco SerafinMarch 20, 2014 44 / 48

Page 117: Using Git Inside Eclipse, Pushing/Cloning from GitHub

Introduction Push new local project on remote Clone remote repo in your local Push modifies of cloned project

How to view Git History

Git History

But first to modify a cloned repository, it’s important to examine the history ofthe entire project. So we are going to open a new tab in our Eclipse IDE:History.

• Click toWindow→Show View→Other ;

• Search and expand Team;• Then select History and click OK.

Riccardo Rigon, Francesco SerafinMarch 20, 2014 44 / 48

Page 118: Using Git Inside Eclipse, Pushing/Cloning from GitHub

Introduction Push new local project on remote Clone remote repo in your local Push modifies of cloned project

How to view Git History

Git History

But first to modify a cloned repository, it’s important to examine the history ofthe entire project. So we are going to open a new tab in our Eclipse IDE:History.

• Click toWindow→Show View→Other ;

• Search and expand Team;• Then select History and click OK.

Riccardo Rigon, Francesco SerafinMarch 20, 2014 44 / 48

Page 119: Using Git Inside Eclipse, Pushing/Cloning from GitHub

Introduction Push new local project on remote Clone remote repo in your local Push modifies of cloned project

How to view Git History

Git History

But first to modify a cloned repository, it’s important to examine the history ofthe entire project. So we are going to open a new tab in our Eclipse IDE:History.

• Click toWindow→Show View→Other ;

• Search and expand Team;• Then select History and click OK.

Riccardo Rigon, Francesco SerafinMarch 20, 2014 44 / 48

Page 120: Using Git Inside Eclipse, Pushing/Cloning from GitHub

Introduction Push new local project on remote Clone remote repo in your local Push modifies of cloned project

How to view Git History

Git History

Now the History tab is open and you can examine all the history of the projecton which you are going to work.

Riccardo Rigon, Francesco SerafinMarch 20, 2014 45 / 48

Page 121: Using Git Inside Eclipse, Pushing/Cloning from GitHub

Introduction Push new local project on remote Clone remote repo in your local Push modifies of cloned project

How to view Git History

Git History

Now the History tab is open and you can examine all the history of the projecton which you are going to work.

Riccardo Rigon, Francesco SerafinMarch 20, 2014 45 / 48

Page 122: Using Git Inside Eclipse, Pushing/Cloning from GitHub

Introduction Push new local project on remote Clone remote repo in your local Push modifies of cloned project

Introduction

Modify the JavaForHydrologists.firstClone project

Now you can modify the simple code that we just cloned.

Some tips:• you can use the TextIO class rather than simple System.out.println();• you can read the string from console, so you can create two simplemethods:

• Read from console;• Write in console.

• COMMENT ALL NEW LINES!

Riccardo Rigon, Francesco SerafinMarch 20, 2014 46 / 48

Page 123: Using Git Inside Eclipse, Pushing/Cloning from GitHub

Introduction Push new local project on remote Clone remote repo in your local Push modifies of cloned project

Introduction

A useful tip: JAutodoc

If you want to have a good standard to comment your code, you can useJAutodoc. It is an Eclipse Plugin for automatically adding Javadoc and fileheaders to your source code. It optionally generates initial comments fromelement name by using Velocity templates for Javadoc and file headers.

Riccardo Rigon, Francesco SerafinMarch 20, 2014 47 / 48

Page 124: Using Git Inside Eclipse, Pushing/Cloning from GitHub

Introduction Push new local project on remote Clone remote repo in your local Push modifies of cloned project

Introduction

A useful tip: JAutodoc

If you want to have a good standard to comment your code, you can useJAutodoc. It is an Eclipse Plugin for automatically adding Javadoc and fileheaders to your source code. It optionally generates initial comments fromelement name by using Velocity templates for Javadoc and file headers.

First install it:Help→Eclipse Marketplace and searchJAutodoc.

Riccardo Rigon, Francesco SerafinMarch 20, 2014 47 / 48

Page 125: Using Git Inside Eclipse, Pushing/Cloning from GitHub

Introduction Push new local project on remote Clone remote repo in your local Push modifies of cloned project

Introduction

How to use JAutodoc

To use JAutodoc, right click on the code and JAutodoc→Add javadoc.

Riccardo Rigon, Francesco SerafinMarch 20, 2014 48 / 48