Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to synchronize Eclipse project workspace with Git-BitBucket?

Tags:

git

eclipse

I am new to Eclipse as well as Git world. Following question may sound like really dumb thing to ask, but I have spent hours finding how to do it and found no way.

We have a Git remote repository that I have cloned using Eclipse's Git perspective. My team makes some changes to code and pushes them to remote repository. I am stuck with "getting latest" code in my local workspace.

Here is what I tried: Open Java EE perspective. Right click on my project -> Team -> Synchronize Workspace. This opens "Team Synchronizing" perspective. It shows me that there are some "incoming" files, but there is no option to "get" them. Only options I see are Merge, Overwrite, Commit. Well, none of them make sense to me.

In TFS world, I just select "get latest" and new versions replace old versions in local workspace. What am I missing?

like image 347
zendu Avatar asked Mar 08 '17 19:03

zendu


People also ask

What is synchronize workspace in Eclipse Git?

SVN Workspace Synchronization is shown in the 'Synchronize View' after a click on a 'Team>Synchronize' menu item or 'Synchronize' button on 'Team' toolbar of the 'Team Synchronizing' perspective. It provides a probability to inspect the changes types of your local copy from the remote one.

How do I clone a Git repository from bitbucket in Eclipse?

From the repository, select the Clone button. In the Clone this repository dialog, select the Clone in VS Code button. If you have not already installed the Atlassian for VS Code extension, you will be prompted to install it. Select Install > select the Reload Window and Open button in the info dialog.


1 Answers

The Synchronize View will only allow you to inspect the differences between the resources in the local workspace and a local or remote tracking branch.

It won't get the last commits.

For that, you need to pull new changes from the upstream branch

Right-click on a project in the Package Explorer and select Team > Pull or right-click on a repository in the Git Repositories view and select Pull to pull new changes from the upstream branch your local branch is tracking.
This also works if resources are selected from more than one repository.

See for instance "EGit Auto-Merge and Conflict Resolution "

https://wiki.52north.org/pub/Documentation/ResolveMergeConflictsInGitEclipse/egit_merge_2.png

To understand more about that workflow, look at GIT Illustrated Cheatsheet -- Working with remote repositories

https://illustrated-git.readthedocs.io/en/latest/_images/git-flows.svg

like image 174
VonC Avatar answered Oct 12 '22 02:10

VonC