5 ms·
So, should we just add .gitignore to .gitignore and problem solved ?
by revskill 4y ago
So, should we just add .gitignore to .gitignore and problem solved ?
- alvis 4y agoNo. 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. :/
- teknopaul 4y agoNonsense. 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.
- NateEag 4y agoMany 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.
- noselasd 4y agoThere's cases where you don't need a build process for a site.
- NateEag 4y agoSure. In those cases a build process is usually trivially easy to put together, and has benefits, so while not necessary it's still beneficial.
- TheHappyOddish 4y agoWhilst 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.
- jahsome 4y agoNope. 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.
- musk_micropenis 4y agoIt 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.
- jahsome 4y agoGreat point!
- manojlds 4y ago.gitignore to Dockerignore (Partly joking)
- kadoban 4y agoYou'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.
- agumonkey 4y agothe classic https://news.ycombinator.com/item?id=31420268 https://news.ycombinator.com/item?id=31420268 > Git ignores .gitignore with .gitignore in .gitignore