Now that we saw some of the git basic
functionalities in practice, let's go a step further. If
you remember I mentioned before that many of these
version control systems are actually integrated into IDE's. So
what were going to look at next is what happens
if we put together git and eclipse. And the
result is egit, or EGit is a plug in
for the eclipse IDE that adds git functionality to eclipse.
So let's see how that works in practice. So
support for git is available in many IDE's including
Eclipse. And if you want to get github
for Eclipse, you should go to eclipse.github.com and you can
download the plugin. So this bring us to the
plugin page and you can use the provided URL
and directions to install the plugin. In this case
we're going to copy this address. So we're going to
Eclipse, Help, Install new software. We can click on Add
to add a new site from which to get software. We
paste the location that we just copied here. And we
can give it a descriptive name. In this case I'll just
call it Eclipse Git plugin. Then when I click okay,
Eclipse will go, and look for plugins. And as you can
see, there are two options. We can select both of them,
and click on next. You can see that the Eclipse identified
a few dependencies. You can click next and accept them. You can
accept the terms and conditions for the plug in, and then just
finish. And at this point, Eclipse will install the plugin, which might
take a little bit of time. So we're just going to speed it up.
And when Eclipse is done, you will get this prompt that will
tell you that you need to restart Eclipse for the plugin to
be actually installed. And at this point, you want to click yes. And
when Eclipse restarts. You'll have your plugin. We're going to go to the git
repository perspective that we can select here. And when we click
OK, you can see that our display will change. And since
we don't have any repository yet, we are provided with the
possibility of adding an existing local git repository, cloning a git repository
or creating a new local git repository. We're going to add an
existing local repository. This is the one that we created earlier,
so we'll select it and click finish, and you can see
that my project is now added to this set of git repositories.
Now let's check out the project from the repository by selecting import
project. And here you can import something as an existing project, you
can use a new project wizard, and in this case I chose
the option of importing as a general project. Then I click Next and
as you can see, I have the project name up there and
I can click Finish. So now, if I go to the resource perspective
by clicking here, I can see that the project has been added
to my set of projects. And I can see all the files within
the project, particularly, if I click on the README, you can see
that we have the Readme file that we created before. Same thing for
the test file. One thing I can do at this point, it
to execute different git commands, perform
different git operations by using the team
submenu in the contactual menu. And here there are several things
I can do including some advanced commands. And just to give it a
shot, I am going to try to click show local history, and this
shows the history of the file. For example it shows the author and
it shows when he was created, when he was authored. Lets make
some changes to this file by adding some new content. Okay. I saved
the file and now I can see that error that indicates that my
file was locally changed. So now if I go to the team menu,
you can see that I have the option to add to the index,
to stage the file. And now I got this new label that star
that shows the files added to the index. And now at this point,
I can go to the team menu again and I can actually commit
the file by selecting the corresponding entry. This allows me to enter
the commit message, exactly in the same way which I could do
that from the command line with the textual editor. And after I
put the comment there, I can actually commit. And now if we
look at the history view, we can see here that we have
a new version for the file that we just modified. And we
can also see the commit comment. And, at this point, if we
had remote repository we could push our changes to that remote repository
as well. Again, using the team submenu and
the contextual menu. And, speaking of remote repositories, what we
are going to see next is how to use GitHub
repositories which are remote repositories that are hosted on GitHub.