Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EGit » Collaboration and excluding files
Collaboration and excluding files [message #758611] Wed, 23 November 2011 16:20 Go to next message
naomi  is currently offline naomi
Messages: 3
Registered: November 2011
Junior Member
Hi,

I'm trying to roll out git in the company i work for. We all use eclipse. I have experience using git from the command line, but I'm hoping to get a workflow in place that can be done entirely within eclipse, for ease of use.

i've run up against the following problem, which seems it must be a common one, but I've googled it to death to no avail.

Question is how to deal with files like .project and .settings/* that you want to ignore? There are two aspects to this problem:

1. Suppose Alice creates a project, shares it and pushes to upstream. Bob can then easily import the project as a whole, but as a result he has Alice's project settings, which is bad. But if Alice excludes the settings files when she shares her project, and does not push them to upstream, then Bob cannot import the project because Eclipse does not recognise it as being a project.

2. I can find no way of removing a file from source control while keeping the local copy. So if some project settings files, or other files that we want to exclude, get into source control by mistake, how could this be corrected? I've tried "untrack" and "ignore" but nothing seems to stop EGit from including a file in source control, and letting it be overwritten by a pull, however hard I try.

Am I just missing something obvious here, or is that kind of workflow just impossible without using the command line? Is there a more suitable way to conceive of what we are trying to do here? Any advice appreciated!
Re: Collaboration and excluding files [message #758837 is a reply to message #758611] Thu, 24 November 2011 11:54 Go to previous messageGo to next message
Stefan Lay is currently offline Stefan Lay
Messages: 338
Registered: July 2009
Senior Member
> 1. Suppose Alice creates a project, shares it and pushes to upstream. Bob can then
> easily import the project as a whole, but as a result he has Alice's project
> settings, which is bad. But if Alice excludes the settings files when she shares her
> project, and does not push them to upstream, then Bob cannot import the project
> because Eclipse does not recognise it as being a project.

Most projects I know do share their .projects and .settings files. Sharing .projects and .classpath makes it easy to import the project into eclipse. Sharing .settings is useful to share compiler settings, source encoding etc.

> 2. I can find no way of removing a file from source control while keeping the local
> copy. So if some project settings files, or other files that we want to exclude, get
> into source control by mistake, how could this be corrected? I've tried "untrack"
> and "ignore" but nothing seems to stop EGit from including a file in source control,


Do you want to delete it in the repository but keep a local copy? This is done by "untrack". It corresponds to git rm --cached on the command line. You then have to commit the change and push it to the server. Anyone who then pulls the change from the server will get the deletion. She then would have to checkout the file from the previous commit to keep the local copy.

After that you should add the files to the .ignore file in the git repo, e.g. with the "ignore" command. You should commit the .ignore file. Then these files will not be presented in the EGit commit dialog or in the staging view anymore.

> and letting it be overwritten by a pull, however hard I try.

If the file is still in the remote repository there is no means in EGit to prevent it from being overwritten by a pull. I even do not know if that's possible on the command line. You would have to stash the local change before pull and so stash apply afterwards.
Re: Collaboration and excluding files [message #758998 is a reply to message #758837] Fri, 25 November 2011 09:38 Go to previous messageGo to next message
R Shapiro is currently offline R Shapiro
Messages: 386
Registered: June 2011
Senior Member
I just want to second the opinion re: sharing .project and .settings files. I don't see how a team can work effectively at all without sharing the .project files, along with any toolkit-specific Eclipse configuration files like .classpath for Java projects and .cproject for C++ projects. I can't think of any reason you would ever want each developer to maintain their own project definition files.

Every team I've ever worked with also wants to share .settings so that everyone sees the same warnings, gets the same formatting etc. This is usually considered a nice feature of Eclipse. It's very hard to keep track of warnings in a reasonable way, for instance, if each developer decides for him/herself which warning checks are enabled. Sharing them ensures consistency.

Settings you don't want to share can be done at the workspace level, which won't create files in the working directory at all. Of course these settings also won't be project-specific, by definition. But then if they're truly specific to the project they probably contribute in some way to project development, and in that case, why not share them with other project team members so that everyone gets the benefit?
Re: Collaboration and excluding files [message #759290 is a reply to message #758611] Mon, 28 November 2011 04:45 Go to previous messageGo to next message
naomi  is currently offline naomi
Messages: 3
Registered: November 2011
Junior Member
Hi,

Thanks very much for your help!

When I untrack a file and then try to commit, I get an error saying commit failed. Is this a known issue?

Thanks again

Naomi

Re: Collaboration and excluding files [message #759597 is a reply to message #759290] Tue, 29 November 2011 05:11 Go to previous messageGo to next message
Stefan Lay is currently offline Stefan Lay
Messages: 338
Registered: July 2009
Senior Member
Hi Naomi,

yes, you are right, there is an open bug: 363405.

There is already a proposed fix for it on our review tool Gerrit:

proposed egit fix
http://egit.eclipse.org/r/#change,4598
and jgit fix
http://egit.eclipse.org/r/#change,4597
for review

So hopefully it will be foxed soon.

Best Regards,
Stefan
Re: Collaboration and excluding files [message #759614 is a reply to message #759290] Tue, 29 November 2011 05:59 Go to previous message
naomi  is currently offline naomi
Messages: 3
Registered: November 2011
Junior Member
Thanks Stefan, that explains it! I was going round in circles with that thinking it was me not getting it.

By they way the reason we need to keep .settings out of the repo is that we are doing Salesforce development and each dev will have their own bit of the cloud to compile their code in - and the individual config for this is defined in .settings so has to be different for each person. (Not sure about .project.) It is a different situation from collaborating on a Java proj.

Cheers
Naomi
Previous Topic:Resetting a specific file
Next Topic:CloneCommand doesnt extrtact downloaded files
Goto Forum:
  


Current Time: Wed Jul 23 06:06:54 EDT 2014

Powered by FUDForum. Page generated in 0.02395 seconds