A standard practice to create repository should always be;
- Main branch should always have a .gitignore and readme file.
- Create a working branch from main
- Develop feature in your working branch
- Before committing, do a merge from remote main to working branch and resolve any conflicts in working branch. This will help you to get team changes merged into your working branch.
- Commit your changes. Create a PR and you are done.
I hope this will help.
How to add gitignore file in existing solution using Visual Studio
Stop tracking the files that should be ignored in Git

