First create a .gitignore.gitignore file where we have to store the names of files and directories to be ignored. To
To ignore a directory;
name_of_directory/ To ignore a file;
name_of_file We don't need to provide the complete path of the file or directory to be ignored,ignored; we just have to provide its name.
If you want to ignore all files with same extention;extension;
*.pyc #will ignore all files with pyc extention EDIT:
Also the above things will only work at the first time when you have not added the files to the gitGit. But if my mistake you added a file to the gitGit and now you want it to be ignored for the rest of the commits, you need to first clear the gitGit cache regarding that file by running this command;
git rm -r --cached <path_of_the_file> And the rest is the same, i.e, add the name to the .gitignore file.