Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

So, should we just add .gitignore to .gitignore and problem solved ?


You're joking of course, but that likely won't do anything useful.

If it's tracked, then ignore has no effect. If it's not tracked, then you might as well use .git/info/excludes which is pretty much the same thing but not tracked, or you can use a global excludes file, like ~/.gitignore is common (you have to configure git to point at it, iirc).

It _could_ make sense to ignore the .gitignore if some other tool is parsing and using that file, but that pattern is...troublesome so I hope not.


~/.config/git/ignore


Hm, did not know that had a default, thanks.


the classic https://news.ycombinator.com/item?id=31420268

> Git ignores .gitignore with .gitignore in .gitignore


.gitignore to Dockerignore

(Partly joking)


No. You never checkout a site directly from git to begin with. You don't let other people know what files are ignored from git doesn't mean people cannot access them. :/


Nonsense.

Everyone uses git for source control, of course you check out a site with git.

All you are telling people with a .gitingore is what is _not_ available.

It means exactly that people can not access them if your site is a checkout, because they aren't there.


Many of us have a build process that converts the contents of a checkout into a deployable site (a.k.a. "build artifact").

The build process can trivially skip .gitignore files (and all other files that are strictly for dev environments).

You then deploy the build artifact to production, with exactly the set of files which ought to be there.


There's cases where you don't need a build process for a site.


Sure.

In those cases a build process is usually trivially easy to put together, and has benefits, so while not necessary it's still beneficial.


Whilst that's _sometimes_ true, there are plenty of cases where there's no additional value compared to just dragging the file into your FTP client.


Nope.

Paths in .gitignore means git ignores them. Doesn't mean the file doesn't exist. It means it's not in source control.

An example is a .env file. It may very well be _required_ in many PHP or node projects but it's going to be ignored.


It doesn't even mean it's not in source control. It just means that IF it's not in source control it won't be added to a change set automatically. gitignore has no effect on files which are already tracked, and even files which are not currently tracked can be explicitly added.


Great point!




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: