4 ms·
There is value in "making a decision" for each untracked file, of whether to explicitly add it or ignore it. This combines well with things like a PS1 that indi
by ekimekim 4y ago
There is value in "making a decision" for each untracked file, of whether to explicitly add it or ignore it. This combines well with things like a PS1 that indicates if you have any unclean state (including both changes and untracked files). Every single time I find myself with an untracked file, I can either add it because I want it tracked, put it in .gitignore if it's something generated that I want my whole team to ignore, or put it in .git/info/exclude if it's something I've done locally that doesn't fit either of the above.
- alex_smart 4y ago>There is value in "making a decision" for each untracked file, of whether to explicitly add it or ignore it. I would argue that you should decide between explicitly adding it or ignoring it, or deliberately doing neither. >This combines well with things like a PS1 that indicates if you have any unclean state (including both changes and untracked files). If you intend to keep untracked files in your directory, choose a PS1 that does not bother you about untracked files. You are losing important information from git status when you exclude untracked files that you are actually working on and not just some random junk your ide generated. What if you look at the git status and conclude that there are no unchanged files worth tracking and then with that false sense of safety decide to run 'git clean -fdx'? You would lose those files permanently! I honestly don't understand why the presence of untracked files in your git status is such a bother to you!? Like how exactly does it hurt?
- Hackbraten 4y agoCognitive clutter. Some people don’t care but it distracts me to no end. I want `git status` to tell me things that matter. I certainly don’t want a meaningful code change sandwiched between an open editor swap file and some for-my-eyes-only temporary design scratch pad. > then with that false sense of safety decide to run 'git clean -fdx'? You would lose those files permanently! Correct, and that’s one of the reasons why the `-f` switch might be a poor fit. I use `-i` instead.
- alex_smart 4y ago>I certainly don’t want a meaningful code change sandwiched between an open editor swap file We are specifically not talking about the junk files created by editors and ides here. We are talking about things like notes and exploratory code that you have written that you have no intention of committing, at least not right away. Why wouldn't you want to see them in your `git status`? Another problem with putting such files in gitignore is that those files will become invisible to an increasingly large number of tools (vscode, ag aka silversearcher, ripgrep, emacs's projectile to name a few) that rely on gitignore to filter out unwanted files. So now, as far as these tools are concerned you have put your notes and experiments in the same category of files as editor junk and build artifacts. You either search them all or none at all.
- Hackbraten 4y ago> Why wouldn't you want to see them in your `git status`? I tend to function poorly around cognitive clutter. It distracts me from the important stuff: the files I’ve decided to put under version control. YMMV. > will become invisible to an increasingly large number of tools (vscode, ag aka silversearcher, ripgrep, emacs's projectile to name a few) That doesn’t really seem to be the case with VS Code. Ignored files appear grey but they’re still showing up for me.
- alex_smart 4y ago>Ignored files appear grey but they’re still showing up for me. They show up greyed out in the explorer yes, but they won't appear when you navigate with "Go to File" (ctrl+p) and they won't be searched through with "Search" (ctrl+shift+f).
- Hackbraten 4y agoGood point!