basics of settings.php and settings.local.php?
Its common to either include a local settings file from settings.php or create a site folder for local development (local.mysite.com) that has a settings file that will be used. In either case, both are gitignored so its only for you. This also avoids the annoying issue when Drupal locks the site folders from being written, causing git errors when pulling or switching branches.