Mark a file in the GIT repo as temporarily ignored

We’re migrating from Perforce to GIT. In perforce, there were some files that I’d want in the repository, but they shouldn’t be checked in by individual developers regularly. Things like eclipse project files. Each dev might get the initial .project file, but then tweak it slightly for their environment.

With P4, I could take those files, put them in a separate changelist and forget about them. Syncing wouldn’t overwrite them and they wouldn’t get committed when I commited my default changelist.

  • Using Git, if some commits are lost, how to view it or get it back?
  • Merge branch '2.8' into '3.2'?
  • Git search history and show diff
  • Issue with git pull master is out of sync with origin master
  • Is this git's correct behavior for “git add” with subfolders?
  • Why can't I git subtree pull --rebase?
  • Is there a way to do something similar with GIT?

    I’d like to still be able to “git commit -a”

  • Add another user to project owners in Github
  • Roll back my github fork to an earlier commit
  • cloning error when checking out private github repo
  • Why would all of my files have duplicates with a '~' at the end?
  • changing all the logs to another branch
  • Git: How to create a new branch from a branch which is not current?
  • 2 Solutions collect form web for “Mark a file in the GIT repo as temporarily ignored”

    If you need a common base for those (.project, .classpath, …), you can:

    • version template version of those files (.project_tpl, .classpath_tpl, …)
    • use a filter driver to generate, on checkout, the actual files (which won’t be versioned, and only modified locally by the developers)

    alt text http://progit.org/figures/ch7/18333fig0702-tn.png

    (the ‘clean‘ step during commit wouldn’t do anything for those templates.
    Only the ‘smudge‘ step is used here, to generate the private files)

    Note: this is a slight “mis-use” of a filter driver, which is supposed to process only file contents, not to generate new ones.
    But it could help you in your scenario (provided your ‘smudge‘ script doesn’t overwrite blindly the eclipse files if they happen to already be here.)

    You are probably looking for

    git update-index --assume-unchanged .project

    Git Baby is a git and github fan, let's start git clone.