I'm so sick of these articles telling me what to do with meaningless subjective justifications
.gitignore Everything by Default
71–80 of 182 posts
Re: .gitignore Everything by Default
#72Re: .gitignore Everything by Default
#73Re: .gitignore Everything by Default
#74Earlier quoted context omitted.
What does that do, add already tracked files only?
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.
The -p presumably stands for pInteractive with a silent p :)
Re: .gitignore Everything by Default
#75I don’t ignore by default, but only stage the items I explicitly want. I can’t tell you how many times I’ve been pairing with someone when they just say “git add .”, I’m always confused by that choice. I get it, but I’ve seen more problems arise from adding all than being consistently selective. To each their own.
I use "git add ." (or rather -A), but I will always do a "git status" first to make sure I'm not doing something silly. Of course you still have to be careful about subdirectories, which is why I usually also do a "git status" again before committing.
https://kapeli.com/cheat_sheets/Oh-My-Zsh_Git.docset/Content...
Re: .gitignore Everything by Default
#76Earlier quoted context omitted.
>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.
Now walk through exactly what would happen when those lazy people follow this approach… You see the issue right?
Adding extra, sensitive, files would not cause test failures, and even if they do (via secret scanners, etc), it is too late at that point because they will have already been shared upstream.
I am not sure the juice is worth the squeeze here, but it has some logic to it.
Re: .gitignore Everything by Default
#77Earlier 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
#78This 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.
```.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 there's no project where I want the state of the repo to be wrong, but my local state saving me unknowingly, as I know it'll bite others.
Re: .gitignore Everything by Default
#79Re: .gitignore Everything by Default
#80This 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.
Keys, npm directories and huge binaries are fixed by deleting them later on. The horror.