Hacker News new | ask | show | jobs
by jpitz 4154 days ago
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."
1 comments

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.
Agreed. The article isn't particularly useful because it essentially says "this is how you solve a 'problem' that I'm only going to demonstrate by giving an example I immediately dismiss" and not explaining the type of situation in which this might be useful. Every time I've found myself in a similar situation, the problem has not been that git doesn't allow me to pretend that certain lines in a file don't exist, it's been that my design has been lacking.