All you need to do is create a file named .gitignore in your project's directory. Then you can ignore directories by entering the directory name into the file (with a slash appended):
dir_to_ignore/
For more infomation read this official doc from git-scm
For more commands like this please go through the following tutorial that will help you understand the git