Live data from Hacker News

.gitignore Everything by Default

packagemain.tech

81–90 of 185 posts

Re: .gitignore Everything by Default

#81
post #80
post #10

This seems like bad advice. I've very rarely committed extra files by accident, but I would 100% forget to unignore files I meant to commit. If you're doing an initial setup step to gitignore everything, why not just do an initial setup step to gitignore the usual files? Make a template that you copy into all of your repos.

Most of the colleagues I've worked with only use "git add ." without checking first. Keys, npm directories and huge binaries are fixed by deleting them later on. The horror.

The problem is that those developers are also going to forget to update the ignore-by-default .gitignore to allow files, so there will be missing files. And they won't see any problems, because it works on their machine.

Re: .gitignore Everything by Default

#83
post #13
post #10

This seems like bad advice. I've very rarely committed extra files by accident, but I would 100% forget to unignore files I meant to commit. If you're doing an initial setup step to gitignore everything, why not just do an initial setup step to gitignore the usual files? Make a template that you copy into all of your repos.

>This seems like bad advice. I've very rarely committed extra files by accident, [...] You clearly haven't seen the people who are lazy and so just do `git add . && git commit -m ... && git push -f origin` every time.

> You clearly haven't seen the people who are lazy and so just do `git add . && git commit -m ... && git push -f origin` every time.

I’ve worked with and managed plenty of people like that and those are the people I least want doing something like this. Seeing the flotsam and jetsam of .DS_Store etc. are an early warning sign they aren’t paying any attention to what they push and the sooner that gets caught and addressed the better.

Re: .gitignore Everything by Default

#86
post #80

Earlier quoted context omitted.

Most of the colleagues I've worked with only use "git add ." without checking first. Keys, npm directories and huge binaries are fixed by deleting them later on. The horror.

The problem is that those developers are also going to forget to update the ignore-by-default .gitignore to allow files, so there will be missing files. And they won't see any problems, because it works on their machine.

In my opinion this will pretty quickly solve itself though. Accidentally committing keys to the repo potentially ruins your entire week. With a default disallow all list, you might have one bad deploy oopsie and then commit the files.

Re: .gitignore Everything by Default

#87
post #80
post #10

This seems like bad advice. I've very rarely committed extra files by accident, but I would 100% forget to unignore files I meant to commit. If you're doing an initial setup step to gitignore everything, why not just do an initial setup step to gitignore the usual files? Make a template that you copy into all of your repos.

Most of the colleagues I've worked with only use "git add ." without checking first. Keys, npm directories and huge binaries are fixed by deleting them later on. The horror.

> Most of the colleagues I've worked with only use "git add ." without checking first.

I mean I do too, then git status to check what went it, then unstage files that aren't supposed to be there, rewrite .gitignore to exclude them (usually), and finally commit. Tends to be faster than manually adding each file/path. Alternatively, I start out with `git add -p` (interactive) and go through that workflow.

Re: .gitignore Everything by Default

#88
post #13
post #10

This seems like bad advice. I've very rarely committed extra files by accident, but I would 100% forget to unignore files I meant to commit. If you're doing an initial setup step to gitignore everything, why not just do an initial setup step to gitignore the usual files? Make a template that you copy into all of your repos.

>This seems like bad advice. I've very rarely committed extra files by accident, [...] You clearly haven't seen the people who are lazy and so just do `git add . && git commit -m ... && git push -f origin` every time.

I do this. What's wrong with this approach and how should it be done correctly?

Re: .gitignore Everything by Default

#90
post #13
post #10

This seems like bad advice. I've very rarely committed extra files by accident, but I would 100% forget to unignore files I meant to commit. If you're doing an initial setup step to gitignore everything, why not just do an initial setup step to gitignore the usual files? Make a template that you copy into all of your repos.

>This seems like bad advice. I've very rarely committed extra files by accident, [...] You clearly haven't seen the people who are lazy and so just do `git add . && git commit -m ... && git push -f origin` every time.

So the better alternative is for them to leave out files that should be committed?
Post reply on HN