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.
> why not just do an initial setup step to gitignore the usual files? Or even better, have a proper global gitignore file on your computer…
.gitignore Everything by Default
111–120 of 185 posts
Re: .gitignore Everything by Default
#112Earlier quoted context omitted.
Recovery from forgetting to add something is _much_ easier than recovery from adding some weird configuration file with plaintext private keys in it.
I usually have *secret in .gitignore and append .secret to any files with secrets.
Re: .gitignore Everything by Default
#113This 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.
I have a small user-global gitignore that most of the job for me, ```.gitignore # Ignores ## Unix hidden files .* ## Temporary files and backups *~ *.swp *.bak # Exceptions !.ignore !.gitignore ``` But I tend to copy it over and extend it as I go, and there's well-known reference gitignore files to skim for if you have anxiety around any particular language/editor/tool. Now, I could extend my user-global ignore, but…
I'd add .nvmrc and .npmrc if you work with NodeJS.
Re: .gitignore Everything by Default
#114Earlier quoted context omitted.
> why not just do an initial setup step to gitignore the usual files? Or even better, have a proper global gitignore file on your computer…
The repo should define rules for the repo, no? You have to hope other contributors have a similar local gitignore?
Re: .gitignore Everything by Default
#115Just look at git status before you commit :eyeroll:.
Re: .gitignore Everything by Default
#116This 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.
Re: .gitignore Everything by Default
#117Earlier quoted context omitted.
It interactively shows you each change that would be added and lets you decide whether it should be staged or not. Down to the hunk level, so you can partially stage a file if you so choose.
Oh, that's neat. The -p presumably stands for pInteractive with a silent p :)
Re: .gitignore Everything by Default
#118Earlier quoted context omitted.
I usually have *secret in .gitignore and append .secret to any files with secrets.
That's cute, too bad it's a config file mandated by your boss and it has to be called "terribletool.yaml."
Especially the humility it requires - remember being mad when my younger brother joined my Factorio game and changed smelters setup. To an actually better one - one thing when people correct your technical solutions, double so bad when they are actually right.
Re: .gitignore Everything by Default
#119This 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.