When not to use git
Obviously, there are exceptions to every rule, but you should definitely think twice before using git in the below circumstances.
Binary files
Binary files aren't great to inspect using git. Every time they are updated the whole file will look competely different (no matter how small the change was). It's generally better to "build" or generate binary files (in a consistent way) when you need them and not track them in git.
Compressed files
Some file types will compress information and bundle metadata in the files. If this is happening, then the one line change you made in the text will result in a huge volume of changes in the compressed files. Again, it's generally better to build/generate these compressed files where possible.
Secrets
This one happens all too often... You accidentally put tracked secrets in git. They will now be tracked forever (unless you're willing to risk a dodgy git rebase or git filter-branch). If you consistenyly put your secrets somewhere outside of git, you never have to worry about accidentally sharing your secrets with the world.
You can use a .env
file if you only need your secrets in a few places locally (and exclude this from being tracked in git), you can use sops or git-secret to track encrypted secrets in your repository or you can use an external service like AWS secrets manager (if you're rich) which allows you to use role based authentication (no passwords required).
Data
git
works a lot like a database, but you shouldn't use it as one! Throwing lots of large data files in git can cause accidental storage of information that you shouldn't be storing (personally identifiable information committed in git history is never fun) and can quickly slow down your git repo! Some people struggle with git's performance in monorepos, so imagine amplifying this by storing large data files in git! Ideally data should be stored in a database, so.... go find one and use it!