▲ | .gitignore Everything by Default(pliutau.com) | |||||||
19 points by der_gopher 2 days ago | 6 comments | ||||||||
▲ | flysand7 2 days ago | parent | next [-] | |||||||
There's something similar I've done programming on linux. I've been working on some things in Odin programming language for a while and there are a ton of changes I've made where the commit contained an executable, because when Odin compiler makes the executable it names it after the main package's directory, without suffix. Once I complained about this to the community someone suggested a clever gitignore hack:
This by default ignores all files, except those that have a suffix and directories. I think this is a useful lesson - if you flip which files you ignore you can change the failure mode from "I accidentally committed a huge file into a repo" to "why isn't it working?". The latter can be pretty much be answered by good CI testing (maybe not always though). | ||||||||
▲ | thomascountz 2 days ago | parent | prev | next [-] | |||||||
Instead of ignoring everything, this is how I manage my $HOME directory of dotfiles via a bare git repo.
Nothing is shown as untracked by default. When I add new config files to track, I have to add them to stage them explicitly.The only sticking point is when I forget to use `git add -u .` when committing changes to files which are already being tracked. I don't remember why I went with this over the global * ignore. | ||||||||
▲ | austinjp 2 days ago | parent | prev | next [-] | |||||||
I discovered this[0] "allowlist" approach for Go a while ago:
[0] https://github.com/github/gitignore/blob/main/community/Gola... | ||||||||
▲ | Cloudef 2 days ago | parent | prev | next [-] | |||||||
You can also gitignore everything and add files with the -f flag | ||||||||
| ||||||||
▲ | Noumenon72 2 days ago | parent | prev [-] | |||||||
This is a smart pattern with .dockerignore where it keeps a lot of huge things from getting copied into the context... but it's also so confusing every time your container doesn't have the new file you created. I think you're going to have to allow `app/*` which means you will be checking in some .DS_STORE files anyway. |