Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git default files (ignoring after first pull)

Tags:

git

How would you go about setting up this scenario in git:

My source has a settings file with configuration settings such as db connection credentials, etc... (this is a Drupal source and I'm referring to settings.php)

When developers clone the source, they'll need to go in and change settings specific to their environment. These changes of course should not be pushed back to origin. And at the same time I want them to be able to work with this default template (since most of it will not be changed).

So .gitignore doesn't work here because I want it in their first clone. Do I need to teach every new developer about git update-index --assume-unchanged?

Isn't there a slicker way to do this?

like image 929
ack Avatar asked Dec 21 '11 03:12

ack


People also ask

How do I stop Git from ignoring files?

Git ignore patterns An asterisk is a wildcard that matches zero or more characters. Prepending an exclamation mark to a pattern negates it. If a file matches a pattern, but also matches a negating pattern defined later in the file, it will not be ignored.

How does .gitignore work?

The . gitignore file tells Git which files to ignore when committing your project to the GitHub repository. gitignore is located in the root directory of your repo. / will ignore directories with the name.


1 Answers

I would rename database.php to database.php.sample and add database.php to .gitignore.

Whenever a new user comes up, just copy from database.php.sample to database.php and make the appropriate changes.

like image 165
Pedro Nascimento Avatar answered Sep 28 '22 23:09

Pedro Nascimento