-1

I try to ignore a committed ".project" file on Eclipse EGit, without deleting it from my Eclipse project nor the repo.

I have this need :

  • the ".project" file of my Eclipse project must be committed at least at the begining of the project, so that my co-workers can pull it when they will "build" their Eclipse workplace
  • this file could be modified by any of us, but should not be pushed on GIT repo
  • this file must stay on GIT repo all the time, because a co-worker could have to get back the project at any time
  • we are working on Windows, so using command-line is a bit off-subject : I seek for help on Eclipse EGit

We are migrating from SVN to GIT : on SVN, we did not had this kind of problem, because we could not commit some files. On GIT, it seems that we have to commit everything we modify so that we do not have conflicts.

Can anybody help me ?

Thank you !

pierreonthenet
  • 155
  • 1
  • 12
  • As documented in MANY other SO question/answers, it is not possible to have a file in the repo but "ignore"/not track changes to that file. – Mark Adelsberger Aug 30 '18 at 17:13
  • @MarkAdelsberger This might be true for the command line Git, but the question is about EGit. – howlger Aug 31 '18 at 01:40
  • @howlger The eclipse extensions don't change how file tracking fundamentally works in git. – Mark Adelsberger Aug 31 '18 at 04:27
  • @MarkAdelsberger There are no Git _eclipse extensions_. EGit is the Git integration for the Eclipse IDE which is based on Eclipse JGit, a pure Java Git _implementation_. EGit does not require the installation of the command line Git. – howlger Aug 31 '18 at 07:02

1 Answers1

0

Right-click the file and choose Team > Advanced > Assume Unchanged.

See Eclipse Help - EGit Documentation - EGit User Guide - Reference:

Resources can be flagged "assume unchanged". This means that Git stops checking the working tree files for possible modifications, so you need to manually unset the bit to tell Git when you change the working tree file. This setting can be switched on with the menu action Team > Assume unchanged and switched back with the menu action Team > No Assume unchanged.

It should be noted that each co-worker must do this once. A server-side Git hook could reject commits changing .project if a co-worker had forgotten to do so.

howlger
  • 31,050
  • 11
  • 59
  • 99
  • Doesn't meet stated requirements; that removes the file from the subsequent commit. – Mark Adelsberger Aug 31 '18 at 04:28
  • @MarkAdelsberger Could you be more specific about which of the four requirements you mean? – howlger Aug 31 '18 at 07:50
  • 1
    Thank you so much @howlger : it seems to be exactly what I was looking for ! – pierreonthenet Aug 31 '18 at 08:16
  • @howlger - As you're well aware, you've changed your answer since I wrote that comment. Unfortunately your new answer also does not actually meet the user's requirements, as they'll find out once they've tried using it for a while. – Mark Adelsberger Aug 31 '18 at 12:57
  • @pierreonthenet - Beware, while the mechanism used by the described feature is often recommended for your stated purpose, it has problem side-effects that make it a poor solution in almost every instance. – Mark Adelsberger Aug 31 '18 at 13:00
  • @MarkAdelsberger After I tried it, I corrected my answer (that's why SO allows to edit answers). It doesn't answer my question but does add a new one: What are they supposed to find? – howlger Aug 31 '18 at 13:17