Example of how to ignore some files or folders using .gitignore when pushing with git :
Ignore all files or folders that start with a dot .
To ignore some files or folers when pushing with git, go at the root of your project and create and .gitignore file:
touch .gitignore
then open it with vi for example:
vi .gitignore
to Ignore all files or folders that start with a dot . just add the following line:
.*
Ignore pycache folders
To ignore python folder pycache add:
__pycache__/
to the .gitignore file
Make exceptions
To make exceptions add an exclamation mark before the name of files or folders that you to not want to ignore.
For example, to Ignore all files that start with a dot . but .gitignore, just add:
!/.gitignore