Nicolas Trichet
Nicolas Trichet

Reputation: 204

Git ignore push only

Is there a way with git to ignore local changes to a file but continue tracking it into the remote repo ? I wan't to fetch but not push a file.

In my case, I want the .project eclipse file to be committed the first time on the "master" repo, but the dev team doesn't have to push changes made by eclipse plugin.

Upvotes: 10

Views: 5590

Answers (1)

Michael Durrant
Michael Durrant

Reputation: 96454

Though not an official way, this is the workflow we use:

Rename and add add .example at the end of the filename.

Add the actual filename to your .gitignore file (and commit the .gitignore file).

Locally, copy the file to a copy that has the actual filename (now being ignored).

Upvotes: 2

Related Questions