Live data from Hacker News

Git: ignore file lines

benmezger.me

11–20 of 40 posts

Re: Git: ignore file lines

#11

You should establish a proper pattern for storing credentials instead. Many people use environment variables, but you can also use an external configuration file. Another simple pattern used a lot in django: try: from local_settings import * except Exception: pass Then put any variable you want to override in local_settings.py and put local_settings.py in .gitignore

Ok, here, have a better example: I contract for a company which has set rules for their stuff. Trying to change these rules would be an amount of effort similar to becoming CEO, starting out as a deckswabber. One of their project is a web app. It has an .htaccess file. In production it is configured to run like this: Addhandler fcgid-script .fcgi However in development i want it to run like this: Addhandler cgi-scrip…

FWIW we moved to a .htaccess.dist setup and our build tool would populate the actual .htaccess file with either of your examples depending if you were building for development or production.

.htaccess is ignored while the .htaccess.dist template is part of the reop

Re: Git: ignore file lines

#12
post #11

Earlier quoted context omitted.

Ok, here, have a better example: I contract for a company which has set rules for their stuff. Trying to change these rules would be an amount of effort similar to becoming CEO, starting out as a deckswabber. One of their project is a web app. It has an .htaccess file. In production it is configured to run like this: Addhandler fcgid-script .fcgi However in development i want it to run like this: Addhandler cgi-scrip…

FWIW we moved to a .htaccess.dist setup and our build tool would populate the actual .htaccess file with either of your examples depending if you were building for development or production. .htaccess is ignored while the .htaccess.dist template is part of the reop

That still means i need to trigger a rebuild on every pull/checkout/reset. Only a marginal improvement, really.

Re: Git: ignore file lines

#13

In practice, I never use 'commit -a' or 'git add -A'. I prefer to use 'git gui' to interactively stage files or just specific lines. This way I can be sure of what is being committed.

I use git add --patch

My teammates probably get tired of hearing it, but every time someone erroneously commits some file or line I advocate its use.

Re: Git: ignore file lines

#14

In practice, I never use 'commit -a' or 'git add -A'. I prefer to use 'git gui' to interactively stage files or just specific lines. This way I can be sure of what is being committed.

I actually prefer `git add -i` if I want more fine-grained control like that.

Re: Git: ignore file lines

#16

You should establish a proper pattern for storing credentials instead. Many people use environment variables, but you can also use an external configuration file. Another simple pattern used a lot in django: try: from local_settings import * except Exception: pass Then put any variable you want to override in local_settings.py and put local_settings.py in .gitignore

Why would you do that? Store configuration in a checked-in directory?

Do you expect to develop on your production systems?

Do you also store databases in the same directory?

I can not think of a possible use case for this, but I guess there must be since this at least someone seems to recognize it.

Re: Git: ignore file lines

#17

You should establish a proper pattern for storing credentials instead. Many people use environment variables, but you can also use an external configuration file. Another simple pattern used a lot in django: try: from local_settings import * except Exception: pass Then put any variable you want to override in local_settings.py and put local_settings.py in .gitignore

You're missing the point.

Re: Git: ignore file lines

#18
post #11

Earlier quoted context omitted.

FWIW we moved to a .htaccess.dist setup and our build tool would populate the actual .htaccess file with either of your examples depending if you were building for development or production. .htaccess is ignored while the .htaccess.dist template is part of the reop

That still means i need to trigger a rebuild on every pull/checkout/reset. Only a marginal improvement, really.

We only need to rebuild that file when we want to change it, which doesn't happen often. It's been at least a year since I changed my local dev copy for our main project and has survived many pulls/branches/resets

What kinda stuff are you putting in .htaccess that changes so often?

Re: Git: ignore file lines

#19

You should establish a proper pattern for storing credentials instead. Many people use environment variables, but you can also use an external configuration file. Another simple pattern used a lot in django: try: from local_settings import * except Exception: pass Then put any variable you want to override in local_settings.py and put local_settings.py in .gitignore

Ok, here, have a better example: I contract for a company which has set rules for their stuff. Trying to change these rules would be an amount of effort similar to becoming CEO, starting out as a deckswabber. One of their project is a web app. It has an .htaccess file. In production it is configured to run like this: Addhandler fcgid-script .fcgi However in development i want it to run like this: Addhandler cgi-scrip…

Another example: IDE configuration settings.

Projects sometimes check in an IDE formatting file settings to ensure that all developers use the same formatting. There are a couple of times where I wanted to add my own little formatting detail (which didn't conflict with the project's) but couldn't because doing so would mark that file modified and force me to remember to undo my changes before each push.

With the hack from the article, I have now a working solution out of this.

Re: Git: ignore file lines

#20

You should establish a proper pattern for storing credentials instead. Many people use environment variables, but you can also use an external configuration file. Another simple pattern used a lot in django: try: from local_settings import * except Exception: pass Then put any variable you want to override in local_settings.py and put local_settings.py in .gitignore

Ok, here, have a better example: I contract for a company which has set rules for their stuff. Trying to change these rules would be an amount of effort similar to becoming CEO, starting out as a deckswabber. One of their project is a web app. It has an .htaccess file. In production it is configured to run like this: Addhandler fcgid-script .fcgi However in development i want it to run like this: Addhandler cgi-scrip…

> Trying to change these rules would be an amount of effort similar to becoming CEO

That's not even remotely possible.

Post reply on HN