Earlier 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.
> people who are lazy and so just do `git add . && git commit -m ... && git push -f origin` every time. People? Even LLMs do that
.gitignore Everything by Default
141–150 of 185 posts
Re: .gitignore Everything by Default
#142I've worked on projects with years-old local repos full of untracked junk, yet never needed .gitignore and never added and published anything by accident.
Re: .gitignore Everything by Default
#143It is weird that quite a few developers comes up with advices where they seem to come from a world where they work alone, have not work with enough people, or with enough projects. In this case, a `.gitignore_global` takes care of the usual suspects that he mentioned `.DS_Store files, IDE config, compressed files, etc.`. Even if something goes wrong, it is usually caught during the initial scaffold before critical fi…
> It is weird that quite a few developers comes up with advices where they seem to come from a world where they work alone, have not work with enough people, or with enough projects. What is weird about it?
Re: .gitignore Everything by Default
#144Earlier quoted context omitted.
You can just add it in a user-level gitignore instead of ignoring it in every repo. See: ~/.config/git/ignore
I only realized very recently that being able to specify .gitignore files in any part of a repo can be combined with wildcards to just put `.gitignore` with `*` in a arbitrary directories to make them get ignored without needing to modify any wider configuration.
Re: .gitignore Everything by Default
#145Earlier 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.
Re: .gitignore Everything by Default
#146If people want to apply this mechanism, it shall be not much of a hassle for writers of most (modern) programming languages, as they mostly have some `src/` directory (maybe also some `tests/`) that contains all source codes for a quick `git add`. For Golang users, I dunno...
Re: .gitignore Everything by Default
#147This 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
#148Earlier quoted context omitted.
git add . is nondestructive and reversible. I tend to do git add . and then run git status. I’m far more interested in confirming my mental model of what I am about to commit if I git commit right now than my mental model of what will be added if I git add right now. If I didn’t already have that muscle memory I might try to switch to git add -v . which would tell me what files it added. I’d argue that a sane git wou…
No, ”git add .” is not easily reverted, there’s no git sub command for de-adding files from the staging area. You have to copy the whole folder (hope you have enough disk space), checking out an older commit (hard), and copy specific files from the copied folder. Pita. This is actually a general problem with git and most cli tools, where it would be possible and useful to undo an action, but the tool developer cannot…
to unstage files you ran git add accidentally on
Re: .gitignore Everything by Default
#149The author likely meant .dockerignore everything, that is the way to go.
Re: .gitignore Everything by Default
#150The habit of putting everything in /wrk folder will grow on you. Sometimes wrk folder is bigger than src