Git: ignore file lines
benmezger.me
Git: ignore file lines
1–10 of 40 posts
Re: Git: ignore file lines
#2Another 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
Re: Git: ignore file lines
#3You 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
"Of course this is a stupid example, you would probably
put the username, password and other important stuff in
another file, say a config file, but let’s assume that
this is not possible, or somehow this variable cannot be
else where."Re: Git: ignore file lines
#4You 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
If you read what TFA says: "Of course this is a stupid example, you would probably put the username, password and other important stuff in another file, say a config file, but let’s assume that this is not possible, or somehow this variable cannot be else where."
Re: Git: ignore file lines
#5Earlier quoted context omitted.
If you read what TFA says: "Of course this is a stupid example, you would probably put the username, password and other important stuff in another file, say a config file, but let’s assume that this is not possible, or somehow this variable cannot be else where."
I'd still argue that this is an anti-pattern. If you find yourself in a situation where you want to leave out a line from git in the middle of a file, you should reconsider the structure of your code/project/whatever.
Re: Git: ignore file lines
#6Re: Git: ignore file lines
#7In 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.
Re: Git: ignore file lines
#8Re: Git: ignore file lines
#9You 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
Re: Git: ignore file lines
#10You 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
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-script .fcgi
Normally you'd just put the entire file on ignore with --assume-unchanged, but that doesn't work well, since the file also contains other bits of configuration that are important for the app, and get changed fairly frequently.OP's tool is perfect for this kind of situation.