The following git ignore file can help you when searching for best practices on GIT in combination with drupal 8. For easy understanding: this makes sure your contrib modules and themes are NOT added to version control. You should deploy them via composer.
# Ignore directories generated by Composer
/drush/contrib/
/vendor/
/web/core/
/web/modules/contrib/
/web/themes/contrib/
/web/profiles/contrib/
/web/libraries/
# Ignore all site specific data
/web/sites/*
!/web/sites/default/
!/web/sites/example.sites.php
# Ignore IDE files
/.idea/
/.vscode/
*.iml
*.code-workspace
# Ignore all log files
*.log
# Ignore node modules
node_modules
# Ignore some css related stuff
*.css.map
*.css.map.map
# Ignore default text files
/CHANGELOG.txt
/COPYRIGHT.txt
/INSTALL*.txt
/LICENSE.txt
/MAINTAINERS.txt
/UPGRADE.txt
/README.txt
sites/README.txt
sites/all/modules/README.txt
sites/all/themes/README.txt