ignoring local config files in git

There are some local files (that are part of our repository) in a rails app that I would like git to ignore. Basically, I’d like git to ignore all changes I make to anything in the config/environments directory and to the config/application.rb file. I don’t want to use .gitignore because I don’t want OTHER people working on the code base to have their configurations ignored by git. Basically I’m doing a lot of testing that modifies the config files and sometimes my config changes are checked into a github which at a minimum is embarassing and at worst causes issues with the production environment.

What’s the best approach here?

  • Git - multiple working copies without bare copy in between
  • Running a multi project Maven-built webapp on Heroku?
  • To color a limited number of lines in git log --oneline
  • is it possible to transfer a commit to another branch
  • How do I get a local git checkout to reflect precisely a known remote commit and nothing more?
  • How can I document a branch in a remote repository?
  • Jenkins + Git plugin CheckoutConflictException
  • How to push code as different user?
  • What to ignore in Git with Cowboy / erlang.mk project?
  • Prevent Django SQLite db from being overwritten while pushing to Heroku
  • How do I pass a literal forward slash into Node.js in Git Bash for Windows?
  • developing at home and office, would GIT be easier than SVN using xcopy?
  • 4 Solutions collect form web for “ignoring local config files in git”

    You can set up a global .gitignore.

    Although, it will still see changes in files that already are in the repository. Here’s how you work around this. You can probably make a bash macro out of it.

    You can do git update-index --assume-unchanged config/application.rb and git will not notice any changes you make to the local copy of that file unless you explicitly use git add.

    My understanding is that .gitignore and friends won’t change how files that are already put into the repository are handled, only whether untracked files are presented as candidates.

    You can define a global .gitignore that would be your machine specific, not checked into project repository.

    check for the .gitignore file.If not just create a file .gitignore and mention the list of files you want to ignore like this config/database.yml

    /log/*.log /tmp
    Git Baby is a git and github fan, let's start git clone.