Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git and Rails: ignore database.yml

Tags:

git

macos

gitosis

I finally made a great step by abandoning SVN for Git and loving it. It must be somewhere, but I can't really find on how to do this, gitosis friendly.

I have my repo 'site' stored on a remote machine. I push my working copy and pull this data on a production machine. One mayor difference though is 'one' file: database.yml, which will never change on the production machine.

Is it possible (and if so, how), when the data is pulled from the repo, to "ignore" only this file? I am doing this manually at this point, but some elegance would be most appreciated.

Thanks.

like image 989
Shyam Avatar asked May 18 '10 12:05

Shyam


1 Answers

Yes, it is possible.

git update-index --skip-worktree FILENAME

or

git update-index --assume-unchanged FILENAME

where FILENAME would be config/database.yml for your case.

If you use the second command (assume-unchanged), the files will revert after git reset command.

like image 89
Evgenii Avatar answered Oct 23 '22 14:10

Evgenii